Python 3.x 使用纳斯达克API,可以';不要在urlopen上使用解码

Python 3.x 使用纳斯达克API,可以';不要在urlopen上使用解码,python-3.x,encoding,httpresponse,urllib,decoding,Python 3.x,Encoding,Httpresponse,Urllib,Decoding,我试图使用NASDAQ API,但似乎无法在Python 3中使用它 我修复了urllib的东西,首先在第92行得到了一个错误,通过将其编码为utf-8修复了这个错误 Before: request_parameters = urllib.parse.urlencode(values) Fix: request_parameters = urllib.parse.urlencode(values).encode('utf-8') 但现在我得到一个错误: response = urllib.re

我试图使用NASDAQ API,但似乎无法在Python 3中使用它

我修复了urllib的东西,首先在第92行得到了一个错误,通过将其编码为utf-8修复了这个错误

Before:
request_parameters = urllib.parse.urlencode(values)
Fix:
request_parameters = urllib.parse.urlencode(values).encode('utf-8')
但现在我得到一个错误:

response = urllib.request.urlopen(req)
>>>TypeError: cannot use a string pattern on a bytes-like object
当我试图通过解码修复它时,我得到:

 response = urllib.request.urlopen(req).decode()
 OR
 response = urllib.request.urlopen(req).decode('utf-8')
 >>>AttributeError: 'HTTPResponse' object has no attribute 'decode'
这就是我导入的内容:

 import urllib.request
 import urllib.parse
 import xml.etree.cElementTree as ElementTree
 import re
 from pprint import pprint
 import matplotlib.dates as mdates
 import matplotlib.pyplot as plt
 import datetime as dt
谢谢你的帮助