Programmatically access contact_data API using Python3

Am trying to access the below API to get access token but am getting error mentioned below the code snippet:

from requests.auth import HTTPBasicAuth
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session

auth_token_url = "https://authz.constantcontact.com/oauth2/default/v1/token"

client = BackendApplicationClient(client_id=client_id)
oauth = OAuth2Session(client=client)
basic_auth = HTTPBasicAuth(client_id, client_secret)
token = oauth.fetch_token(token_url=auth_token_url, auth=basic_auth)

What am i missing here? I need to get access token to make api call to below url:

 

 

Is there a way to generate access token that doesn't expire as am trying to build a data pipeline using this API call. 

 

Error:

UnauthorizedClientError: (unauthorized_client) The client is not authorized to use the provided grant type. Configured grant types: [authorization_code, implicit, refresh_token].

1 reply

Quick Links

Leaderboard