I am wondering if you could provide your solution on how to connect my agency's SmartsheetGov by using Smartsheet API with python. I have tried to connect to our agency's SmartsheetGov by Smartsheet API with Python. However all I got is the response of the invalid token (You could tell the message below) after revoking and creating new tokens.
I tried to follow the instruction in the link below and got my API token value (‘FwCw……’) by the steps 1 and 2.
Then, I installed the python SDK by the Smartsheet Python SDK. The python script below was used to connect our SmartsheetGov.
import os
import smartsheet
os.environ['SMARTSHEET_ACCESS_TOKEN'] = "FwCw...."(The incomplete value of token here was for the security)
smartsheet_client = smartsheet.Smartsheet()
sheetID = 7012956985038964
sheet = smartsheet_client.Sheets.get_sheet(sheetID)
print(sheet)
However, I got the error message below:
{"response": {"statusCode": 401, "reason": "Unauthorized", "content": {"errorCode": 1002, "message": "Your Access Token is invalid.", "refId": "367b8x"}}}
{"result": {"code": 1002, "errorCode": 1002, "message": "Your Access Token is invalid.", "name": "ApiError", "recommendation": "Do not retry without fixing the problem. ", "refId": "367b8x", "shouldRetry": false, "statusCode": 401}}