Skip to content

Instantly share code, notes, and snippets.

@is
Created September 27, 2010 16:11
Show Gist options
  • Save is/599274 to your computer and use it in GitHub Desktop.
Save is/599274 to your computer and use it in GitHub Desktop.
Sample code, msgpack over http post in Python.
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