Skip to content

Instantly share code, notes, and snippets.

@priteshgudge
Created May 21, 2019 14:00
Show Gist options
  • Save priteshgudge/728cbb47b07cae9aa4caf3c1d1f65753 to your computer and use it in GitHub Desktop.
Save priteshgudge/728cbb47b07cae9aa4caf3c1d1f65753 to your computer and use it in GitHub Desktop.
Clever tap event count api
import requests
import json
headers = {
'X-CleverTap-Account-Id': 'PPPPPPPP',
'X-CleverTap-Passcode': 'DDDDDDDD',
'Content-Type': 'application/json',
}
data = {"event_name":"App Launched",
"from":20190501,"to":20190503, # By using dateime in python
"common_profile_properties": {
"geo_fields": [
[
"India",
"Maharashtra",
"Aurangabad"
],
[
"India",
"Maharashtra",
"Pune"
],
]
}}
response = requests.post('https://api.clevertap.com/1/counts/events.json', headers=headers, data=json.dumps(data))
req_id = response.json()['req_id']
count_response = requests.get("https://api.clevertap.com/1/counts/events.json?req_id={}".format(req_id),headers=headers)
count = count_response.json()['count']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment