Created
July 3, 2014 00:57
-
-
Save smerritt/255ad07ee6989c0f44ae to your computer and use it in GitHub Desktop.
chunked HTTP putter
This file contains hidden or 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
#!/usr/bin/env python | |
import httplib | |
import time | |
conn = httplib.HTTPConnection('localhost', '6020') | |
conn.putrequest('PUT', '/sdb2/831/AUTH_test/c/o') | |
conn.putheader('Transfer-Encoding', 'chunked') | |
conn.putheader('Content-Type', 'application/octet-stream') | |
conn.putheader('X-Timestamp', "%016.05f" % time.time()) | |
conn.endheaders() | |
for i in range(10): | |
conn.send('5\r\nabCde\r\n') | |
time.sleep(0.5) | |
conn.send('0\r\n\r\n') | |
resp = conn.getresponse() | |
print resp.status | |
conn.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment