Skip to content

Instantly share code, notes, and snippets.

@ojmccall
Created September 25, 2021 05:54
Show Gist options
  • Save ojmccall/6a8ed7458c232ea6a3810b23d95052f1 to your computer and use it in GitHub Desktop.
Save ojmccall/6a8ed7458c232ea6a3810b23d95052f1 to your computer and use it in GitHub Desktop.
GCP- SFMC Find & Replace Section 2
contentChanged = 0
SQLChanged = 0
SSJSChanged = 0
#get Token Here
try:
url = "https://"+baseURL+".auth.marketingcloudapis.com/v2/Token"
data = {"grant_type":"client_credentials",
"client_id":client_id,
"client_secret":client_secret
}
r = requests.post(url, data=data)
body = json.loads(r.content)
token = body['access_token']
TokenStatus = r.status_code
if TokenStatus != 200:
Failure = 1
StatusMessage = "token request invalid"
else:
Failure = 0
except Exception as e: print("Error from Token request: "+e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment