Python header example

I am looking for an example in python for the following code:

curl --verbose GET
-u apikey: <api_key>

I am working on something that would look like this:

headers = ‘help me’
url = “” + API + “&limit= 1000”
response = requests.get(url, headers=headers)

This works if I sample cookies in chrome when I log into dashboard and put it in headers, but eventually 404 because of expiration. I am trying to give my api or login info to get any response but I dont know how my request is expected.

Thank you for your help.

You should read up on how to use the requests library from python:

I don’t believe that is a valid param, ‘api’ does nothing so you can take it out.

From the example given in the requests auth you could do something like so:

s = requests.Session()
s.auth = ('apikey', your api key here)

s.get("", params={'limit':1000})

doing a session will save your token and keep you authed until it expires and will reauth you when it does.

1 Like

Thank you! I was already reading that page but was lost in all the info.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.