我一直在努力解决这个问题,所以我想我会寻求帮助。
我使用httplib2来获取csv,然后我尝试打开它,但我遇到了问题(可能是编码)。
我有以下代码:
url = "https://ws.webtrends.com/profiles/%s/period_type=trend&format=csv" % (profile_code)
h = httplib2.Http()
h.add_credentials('login', 'password')
response, content = h.request(url)
csv_data = csv.reader(codecs.iterdecode(content, 'utf-8'))
for idx,row in enumerate(csv_data):
print (row)
我从codecs.iterdecode
行收到以下错误:
TypeError: can't concat bytes to int
非常感谢任何帮助。