I am getting this error below when trying to connect to Hubspot using a private app created and Python.
"
Traceback (most recent call last):
File “C:\Users\Anthony.DESKTOP-ES5HL78\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py”, line 971, in json
return complexjson.loads(self.text, **kwargs)
File “C:\Users\Anthony.DESKTOP-ES5HL78\AppData\Local\Programs\Python\Python310\lib\json\__init__.py”, line 346, in
loads
return _default_decoder.decode(s)
File “C:\Users\Anthony.DESKTOP-ES5HL78\AppData\Local\Programs\Python\Python310\lib\json\decoder.py”, line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “C:\Users\Anthony.DESKTOP-ES5HL78\AppData\Local\Programs\Python\Python310\lib\json\decoder.py”, line 355, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “C:\Users\Anthony.DESKTOP-ES5HL78\Documents\Scrapy\projects\auth.py”, line 22, in <module>
auth_token = get_auth_token()
File “C:\Users\Anthony.DESKTOP-ES5HL78\Documents\Scrapy\projects\auth.py”, line 15, in get_auth_token
response_dict = response.json()
File “C:\Users\Anthony.DESKTOP-ES5HL78\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py”, line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
" AND
“Error getting access token: b’{“status”:“BAD_GRANT_TYPE”,“message”:“missing or unknown grant type”,“correlationId”:“daab6538-15f6-4e5a-8172-c70ed3ef3376”}’
Error getting access token: b’{“status”:“BAD_GRANT_TYPE”,“message”:“missing or unknown grant type”,“correlationId”:“6c614382-cf20-47a0-827a-c48c7ac47056”}’
Error getting access token: b’{“status”:“BAD_GRANT_TYPE”,“message”:“missing or unknown grant type”,“correlationId”:“f3d91db5-1610-4b69-856a-d9ff16a7acee”}’
Error getting acce”
Here is my code: "
import requests
CLIENT_ID = ‘e2e6713e-0813-457a-b2c2-19ff2df1407c’
CLIENT_SECRET = ‘9b876b6e-835b-40ba-b48e-216010ce00ea’
ACCESS_TOKEN = ‘i provided access code as per app created’
def get_auth_token():
url = 'https://api.hubapi.com/oauth/v1/pat-eu1-6f9d23ad-ac6e-45a2-aaeb-a62b9554ce61'
data = {
'grant\_type': 'client\_credentials',
'client\_id': CLIENT\_ID,
'client\_secret': CLIENT\_SECRET
}
response = requests.post(url, data=data)
response\_dict = response.json()
if 'access\_token' in response\_dict:
return response\_dict\['access\_token']
else:
print(f"Error: {response\_dict.get('error\_description')}")
return None
auth_token = get_auth_token()
if auth_token:
print(auth\_token)
else:
print("Could not retrieve authentication token.")
"
Please assist?