简体   繁体   中英

GET .json from Helpscout API using Python

I'm a newbie to Python API, and wanted to obtain the json object "Conversation thread" from Helpscout, following their developer API documentation .

I attempted requests.get("https://api.helpscout.net/v1/conversations/{id}.json") (I replaced the id with an actual conversation) but that returns a 401 error.

Helpscout gives out a API_KEY which I need to somehow pass it to the requests. How do I go about doing it?

Thanks!

In [23]: requests.get("https://api.helpscout.net/v1/conversations/10532436.json")
Out[23]: <Response [401]>

您需要在其中添加API密钥...使用: requests.get("https://api.helpscout.net/v1/conversations/{id}.json", auth=('{API_KEY}','X')) ,当然也可以使用从helpcout获得的API_KEY替换API_KEY。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM