Created
September 27, 2010 16:11
-
-
Save is/599274 to your computer and use it in GitHub Desktop.
Sample code, msgpack over http post in Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import msgpack | |
import urllib2 | |
def main(): | |
m = msgpack.packb(['hello', 12]) | |
u = urllib2.urlopen('http://localhost:8080/0', m) | |
s = u.read() | |
u.close() | |
print (len(m), len(s)) | |
v = msgpack.unpackb(s) | |
print v | |
if __name__ == '__main__': | |
main() | |
# vim: ts=2 sts ai |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment