Skip to content

Commit e175eeb

Browse files
committed
Merge pull request #166 from plotly/chunked-requests-updates
updated chunked-requests
2 parents 237c799 + f3df1c0 commit e175eeb

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

plotly/plotly/chunked_requests/chunked_request.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
class Stream:
7-
def __init__(self, server, port=80, headers={}):
7+
def __init__(self, server, port=80, headers={}, url='/'):
88
''' Initialize a stream object and an HTTP Connection
99
with chunked Transfer-Encoding to server:port with optional headers.
1010
'''
@@ -15,6 +15,7 @@ def __init__(self, server, port=80, headers={}):
1515
self._server = server
1616
self._port = port
1717
self._headers = headers
18+
self._url = url
1819
self._connect()
1920

2021
def write(self, data, reconnect_on=('', 200, )):
@@ -60,8 +61,10 @@ def write(self, data, reconnect_on=('', 200, )):
6061
msg = data
6162
msglen = format(len(msg), 'x') # msg length in hex
6263
# Send the message in chunk-encoded form
64+
self._conn.sock.setblocking(1)
6365
self._conn.send('{msglen}\r\n{msg}\r\n'
6466
.format(msglen=msglen, msg=msg).encode('utf-8'))
67+
self._conn.sock.setblocking(0)
6568
except http_client.socket.error:
6669
self._reconnect()
6770
self.write(data)
@@ -75,7 +78,7 @@ def _connect(self):
7578
headers = self._headers
7679
self._conn = http_client.HTTPConnection(server, port)
7780

78-
self._conn.putrequest('POST', '/')
81+
self._conn.putrequest('POST', self._url)
7982
self._conn.putheader('Transfer-Encoding', 'chunked')
8083
for header in headers:
8184
self._conn.putheader(header, headers[header])

plotly/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.4.11'
1+
__version__ = '1.4.12'

0 commit comments

Comments
 (0)