Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: The JSON Object must be str, not bytes #9

Open
Zalkota opened this issue Nov 18, 2017 · 2 comments
Open

TypeError: The JSON Object must be str, not bytes #9

Zalkota opened this issue Nov 18, 2017 · 2 comments

Comments

@Zalkota
Copy link

Zalkota commented Nov 18, 2017

Any Idea how to fix this?

 File "trade.py", line 19, in <module>
    ethereumsummary = api.getmarketsummary(market)
  File "/home/user/Desktop/Projects/Bots/python-bittrex/bittrex/test/bittrex.py", line 62, in getmarketsummary
    return self.query('getmarketsummary', {'market': market})
  File "/home/user/Desktop/Projects/Bots/python-bittrex/bittrex/test/bittrex.py", line 41, in query
    response = json.loads(urllib.request.urlopen(req).read())
  File "/usr/lib/python3.4/json/__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'

@leexxg
Copy link

leexxg commented Dec 6, 2017

Yes,
change line 42
from: response = json.loads(urllib.request.urlopen(req).read())
to: response = json.loads(urllib.request.urlopen(req).read().decode('utf8'))

@espressocannon
Copy link

that give us "TypeError: key: expected bytes or bytearray, but got 'str'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants