0

I'm attempting to make an api call in django to a url.

#api call
url = "https://api.lemlist.com/api/team"
querystring = {"user":apikey}
response = requests.request("GET", url, params=querystring)

Lemlist shows that the following call can be made as follows, but its in a different language:

curl https://api.lemlist.com/api/team \
  --user ":YourApiKey"

https://developer.lemlist.com/#authentication

With the python call noted above, I'm getting a 400 error.

Thanks!

1 Answer 1

1

--user in curl means basic authentication, so you need to use the Basic Authentication provided by the requests module.

url = "https://api.lemlist.com/api/team"
response = requests.get(url, auth=('', 'YourApiKey'))
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks! this is a great help
It's very odd, but this didn't work. got a 401 error.
did you put the : just before your API key ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.