Click here to Skip to main content
15,888,116 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
im assuming the error has something to do with the encoding of the data (utf-8/16)

Code:
Python
import os
import json

req = os.popen('curl -H "Authorization: Bearer USRllWyuqyO3KZpKNxKPAuQsMPoMS2qg5o" "https://us.api.blizzard.com/data/wow/search/item?namespace=static-us&name.en_US=Thunderfury&orderby=id&_page=1&access_token=USRllWyuqyO3KZpKNxKPAuQsMPoMS2qg5o"').read()
parse = json.loads(req)
print(json.dumps(parse, indent=2))


Erorr:
<pre>Traceback (most recent call last):
  File "c:\Users\squid\OneDrive\Documents\programming\wowheadapitest.py", line 4, in <module>
    req = os.popen('curl -H "Authorization: Bearer [secret]" "https://us.api.blizzard.com/data/wow/search/item?namespace=static-us&name.en_US=Thunderfury&orderby=id&_page=1&access_token=[secret]"').read()
  File "C:\Users\squid\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 307: character maps to <undefined>



What I have tried:

Changing the encoding of my files but it doesnt work
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900