how to send data to server using python
Posted
by Apache
on Stack Overflow
See other posts from Stack Overflow
or by Apache
Published on 2010-04-07T10:23:06Z
Indexed on
2010/04/07
10:33 UTC
Read the original article
Hit count: 249
hi experts, how data can be send to the server, for example i retrieve MAC address, so i want send to the server ( i.e 211.21.24.43:8080/data?mac=00-0C-F1-56-98-AD
i found snippet from internet as below
from urllib2 import Request, urlopen
from binascii import b2a_base64
def b64open(url, postdata):
req = Request(url, b2a_base64(postdata), headers={'Content-Transfer-Encoding': 'base64'})
return urlopen(req)
conn = b64open("http://211.21.24.43:8080/data","mac=00-0C-F1-56-98-AD")
but when run,
File "send2.py", line 8
SyntaxError: Non-ASCII character '\xc3' in file send2.py on line 8, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
can anyone help me how send data to the server
thanks in advance
© Stack Overflow or respective owner