Solved

How can I auth in python using a Collection ID and Collection token?

  • 22 March 2021
  • 2 replies
  • 31 views

Hi all! Having trouble understanding how to auth in python using a Collection ID and Collection token. I don't see any example code in documentation. Anyone able to help?
icon

Best answer by Mary Houston 23 March 2021, 15:16

View original

2 replies

Userlevel 4
Badge
Hi @eknudsen :wave: - for using a Collection tokens, you will use the Collection ID instead of your Username. This should help! ```import requests from requests.auth import HTTPBasicAuth collection_id = 'add-collection-id-here' url = 'https://api.getguru.com/api/v1/cards' headers = {'accept': 'application/json'} response = requests.get(url, headers=headers, auth=HTTPBasicAuth("collection-id", "collection-token)") response.json return response```
This worked perfectly @mhouston, thank you!

Reply