Dear hubspot community,
I am writing because I am experiencing some strange problem. Yesterday I wrote a small python script to get the “feedback_submissions” data from one of our hubspot accounts.
It worked fine and I could retrieve data normally.
Today I tried again to retrieve the same data (the script did not change at all) and I got the 401 error (see code and error below).
Can anyone help me understand what can be happening?
The code I am executing is the following:
import hubspotfrom pprint import pprintfrom hubspot.crm.objects.feedback_submissions import ApiExceptionclient = hubspot.Client.create(access_token="my_access_token")try:api_response = client.crm.objects.feedback_submissions.basic_api.get_page(limit=1, archived=False, properties=['hs_sentiment', 'hs_survey_type'])print(api_response)except ApiException as e:print("Exception when calling basic_api->get_page: %s\n" % e)
In my case, the variable “my_access_token” has the actual access token that I get when I created the private app within my hubspot account, with the correct scopes.
And the error I get is:
Exception when calling basic_api->get_page: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Date': 'Thu, 06 Jul 2023 07:53:52 GMT', 'Content-Type': 'application/json;charset=utf-8', 'Content-Length': '299', 'Connection': 'keep-alive', 'CF-Ray': '7e2646c6eb982fbb-MAD', 'CF-Cache-Status': 'DYNAMIC', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains; preload', 'Vary': 'origin, Accept-Encoding', 'Access-Control-Allow-Credentials': 'false', 'x-envoy-upstream-service-time': '3', 'x-evy-trace-listener': 'listener_https', 'x-evy-trace-route-configuration': 'listener_https/all', 'x-evy-trace-route-service-name': 'envoyset-translator', 'x-evy-trace-served-by-pod': 'iad02/hubapi-td/envoy-proxy-598c95b5b7-79ph8', 'x-evy-trace-virtual-host': 'all', 'X-HubSpot-Auth-Failure': '401 Unauthorized', 'X-HubSpot-Correlation-Id': 'c949e659-d2dd-44f5-a77b-ffbcded8b98d', 'x-request-id': 'c949e659-d2dd-44f5-a77b-ffbcded8b98d', 'X-Trace': '2B9FE3E2A7DC4E6CFB4AFD766A17C77E79B265D346000000000000000000', 'Report-To': '{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=IiJ06vzh2w4NUK1cIIHQMApGMMV1itYrNWljQQPQgohUCfJgQYFjsUTcziC0CEK4trOABdt2Ts5jX7Jz60PTM%2BvrFxqiZsBJ%2F5ybeayujIZmEI%2BCBNXJ4FdPBxJHIZsG"}],"group":"cf-nel","max_age":604800}', 'NEL': '{"success_fraction":0.01,"report_to":"cf-nel","max_age":604800}', 'Server': 'cloudflare', 'alt-svc': 'h3=":443"; ma=86400'})
HTTP response body: {"status":"error","message":"Authentication credentials not found. This API supports OAuth 2.0 authentication and you can find more details at https://developers.hubspot.com/docs/methods/auth/oauth-overview","correlationId":"c949e659-d2dd-44f5-a77b-ffbcded8b98d","category":"INVALID_AUTHENTICATION"}
As said, yesterday it worked and now it does not without changing the code.
Thanks in advance!