Error in python API call - Jsondecodeerror

Asked

Viewed 111 times

0

I’m making this call in a Mailchimp API, but it’s returning an error in json that I don’t know how to solve, can help me??

My code:

import requests
import psycopg2


key = 'KEY'
url = 
'https://us17.api.mailchimp.com/3.0/ecommerce/stores/id_loja/carts? 
count=10000'
head = {'anystring':KEY}

r = requests.get(url, auth=('user',key))

info = r.json()

print(info)

Error that returns:

raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
  • I’m not familiar with Mailchimp API documentation, but are you sure your url is correct? Especially in the snippet id_loja: you shouldn’t replace that part with some actual ID?

  • What is the return of the API? I guarantee that if you know the string that the request returned you will know what went wrong.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.