Created
June 7, 2022 20:50
-
-
Save DerekHawkins/b5209478a5cdcdcfa627d6a424c0d7c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tqdm.notebook import tqdm | |
from time import sleep | |
import datetime | |
import requests | |
import base64 | |
import time | |
import os | |
import json | |
import googleanalytics as ga | |
import gspread_dataframe as gd | |
import gspread | |
#Cvent API creds and b64 encoding | |
credentials = {'client_id':'---', | |
'client_secret':'---'} | |
encodedData = base64.b64encode(bytes(f"{credentials['client_id']}:{credentials['client_secret']}", "ISO-8859-1")).decode("ascii") | |
authorization_header_string = f"Authorization: Basic {encodedData}" | |
# Authentication of Cvent API | |
url = 'https://api-platform.cvent.com/ea/oauth2/token' | |
headers = {'content-type': 'application/x-www-form-urlencoded', | |
'Authorization': f'Basic {encodedData}'} | |
params = { | |
"grant_type":"client_credentials", | |
"client_id":f'{credentials["client_id"]}' | |
} | |
token = requests.post(url, params=params, headers=headers).json()['access_token'] | |
event_id = '71213421-1851-4fb4-8e4b-e11fbc1c8e94' | |
call_headers = { | |
'Accept':'application/json', | |
'x-api-key':f'{credentials["client_id"]}', | |
'Authorization': f"Bearer {token}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment