import twisted.web
import twisted.web.client
+import io
+
client_cs = None
def set_client(ci,cs,pw):
hh = { 'User-Agent': ['hippotat'],
'Content-Type': ['multipart/form-data; boundary="b"'],
'Content-Length': [str(len(mime))] }
+
+ bytesreader = io.BytesIO(mime)
+ producer = twisted.web.client.FileBodyProducer(bytesreader)
+
req = agent.request(b'POST',
c.url,
- twisted.web.client.Headers(hh))
+ twisted.web.client.Headers(hh),
+ producer)
req.addTimeout(c.http_timeout, reactor)
req.addCallbacks(req_ok, req_err)
outstanding += 1