我正在尝试使用httplib从Oanda获取一个乐器列表,但是行中有一个错误(不可用的类型):rawData = conn.getresponse()。read(),我没有'我知道如何解决这个问题。有人可以帮帮我吗?
def getInsturmentList(): #GET / v1 / instruments
try:
conn = httplib.HTTPSConnection("api-fxpractice.oanda.com")
url = ''.join(["/v1/instruments"])
headers = {'Authorization' : 'Bearer ' + access_token,
# 'X-Accept-Datetime-Format' : 'unix'
}
conn.request("GET", url, headers)
except Exception,e:
print e
#candles = json.loads(conn.getresponse().read())['candles']
rawData = conn.getresponse().read()
jData = json.loads(rawData)
print jData
Error message:
File "G:/TAAM/Oanda/Oanda_RESTAPI.py", line 187, in getInsturmentList
rawData = conn.getresponse().read()
File "C:\Python27\lib\httplib.py", line 1132, in getresponse
response.begin()
File "C:\Python27\lib\httplib.py", line 453, in begin
version, status, reason = self._read_status()
File "C:\Python27\lib\httplib.py", line 417, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine:
'