Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, client_id, client_secret, access_token, version):
self.__client_id = client_id
self.__client_secret = client_secret
self.__ll_access_token = access_token
self.__rest_client = RestClient(version)
def get_access_token(self):
if not self.__ll_access_token is None:
return self.__ll_access_token
app_client_values = {
"client_id": self.__client_id,
"client_secret": self.__client_secret,
"grant_type": "client_credentials"
}
access_data = self.__rest_client.post("/oauth/token", None, app_client_values, RestClient.MIME_FORM)
if access_data["status"] == 200:
self.__access_data = access_data["response"]
return self.__access_data["access_token"]
else:
raise MPInvalidCredentials(str(access_data))