Skip to content
This repository has been archived by the owner on Mar 20, 2022. It is now read-only.

Commit

Permalink
fix(fn): don't send to identify api unless there is data
Browse files Browse the repository at this point in the history
  • Loading branch information
philbooth committed Sep 29, 2017
1 parent d85f96a commit b1e1507
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions amplitude.py
Expand Up @@ -167,9 +167,10 @@ def send (batches):

print "sending, identify: {}, event: {}".format(len(batches["identify"]), len(batches["event"]))

# https://amplitude.zendesk.com/hc/en-us/articles/205406617-Identify-API-Modify-User-Properties#request-format
requests.post("https://api.amplitude.com/identify",
data={"api_key": AMPLITUDE_API_KEY, "identification": json.dumps(batches["identify"])})
if len(batches["identify"]) > 0:
# https://amplitude.zendesk.com/hc/en-us/articles/205406617-Identify-API-Modify-User-Properties#request-format
requests.post("https://api.amplitude.com/identify",
data={"api_key": AMPLITUDE_API_KEY, "identification": json.dumps(batches["identify"])})

# https://amplitude.zendesk.com/hc/en-us/articles/204771828#request-format
response = requests.post("https://api.amplitude.com/httpapi",
Expand Down

0 comments on commit b1e1507

Please sign in to comment.