mirror of
https://opendev.org/x/pyghmi
synced 2025-01-27 19:37:44 +00:00
Merge "Wrap bytes in a StringIO"
This commit is contained in:
commit
dfe960d5a3
@ -24,9 +24,11 @@ import ssl
|
||||
try:
|
||||
import Cookie
|
||||
import httplib
|
||||
import StringIO
|
||||
except ImportError:
|
||||
import http.client as httplib
|
||||
import http.cookies as Cookie
|
||||
import io as StringIO
|
||||
|
||||
__author__ = 'jjohnson2'
|
||||
|
||||
@ -146,9 +148,11 @@ class SecureHTTPConnection(httplib.HTTPConnection, object):
|
||||
"""
|
||||
if data is None:
|
||||
data = open(filename, 'rb')
|
||||
form = get_upload_form(filename, data, formname, otherfields)
|
||||
form = StringIO.StringIO(get_upload_form(filename, data, formname,
|
||||
otherfields))
|
||||
ulheaders = self.stdheaders.copy()
|
||||
ulheaders['Content-Type'] = 'multipart/form-data; boundary=' + BND
|
||||
ulheaders['Content-Length'] = len(uploadforms[filename])
|
||||
webclient = self.dupe()
|
||||
webclient.request('POST', url, form, ulheaders)
|
||||
rsp = webclient.getresponse()
|
||||
|
Loading…
x
Reference in New Issue
Block a user