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?
Page 1 / 1
Hi @eknudsen
- 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```

```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
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.