8000 Merge pull request #169 from plotly/python3-bytes-decoding-fix · MVReddy/python-api@d9b7cdc · GitHub
[go: up one dir, main page]

Skip to content 10000

Commit d9b7cdc

Browse files
committed
Merge pull request plotly#169 from plotly/python3-bytes-decoding-fix
Python3 bytes decoding fix
2 parents 80fcc59 + d9a117f commit d9b7cdc

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

plotly/plotly/plotly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def get_figure(file_owner_or_url, file_id=None, raw=False):
369369
verify=get_config()['plotly_ssl_verification'])
370370
if response.status_code == 200:
371371
if six.PY3:
372-
content = json.loads(response.content.decode('unicode_escape'))
372+
content = json.loads(response.content.decode('utf-8'))
373373
else:
374374
content = json.loads(response.content)
375375
response_payload = content['payload']

plotly/tests/test_core/test_get_figure/test_get_figure.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
from plotly.plotly import plotly as py
1010
from plotly import exceptions
1111
from nose.tools import raises
12+
import six
13+
import json
14+
15+
from unittest import TestCase
16+
from unittest import skipIf
1217

1318

1419
# username for tests: 'plotlyimagetest'
@@ -191,4 +196,14 @@ def test_all():
191196
"following output is produced...")
192197

193198

199+
class TestBytesVStrings(TestCase):
194200

201+
@skipIf(not six.PY3, 'Decoding and missing escapes is only seen in PY3')
202+
def test_proper_escaping(self):
203+
un = 'PlotlyImageTest'
204+
ak = '786r5mecv0'
205+
url = "https://plot.ly/~PlotlyImageTest/91/"
206+
py.sign_in(un, ak)
207+
print("getting: https://plot.ly/~PlotlyImageTest/91/")
208+
print("###########################################\n\n")
209+
fig = py.get_figure(url)

plotly/version.py

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

0 commit comments

Comments
 (0)
0