-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8bef93
commit 93e0f3f
Showing
4 changed files
with
108 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import json | ||
import os | ||
import platform | ||
import sys | ||
import time | ||
import urllib.request | ||
|
||
|
||
def submit_event(): | ||
"""We collect anonymous usage metrics to improve nbmake. | ||
You can disable them by setting the environment variable NBMAKE_METRICS=0. | ||
""" | ||
mixpanel_token = "8440a5d8fa0ec1d43b6bcaf76037fae7" | ||
url = "https://api-eu.mixpanel.com/track" | ||
|
||
payload = [ | ||
{ | ||
"event": "Invocation", | ||
"properties": { | ||
"token": mixpanel_token, | ||
"$os": platform.system(), | ||
"time": int(time.time()), | ||
"platform": platform.platform(), | ||
"python": sys.version, | ||
"ci": os.getenv("CI", False) and True, | ||
}, | ||
} | ||
] | ||
headers = { | ||
"accept": "text/plain", | ||
"content-type": "application/json", | ||
} | ||
req = urllib.request.Request( | ||
url, data=json.dumps(payload).encode("utf8"), headers=headers | ||
) | ||
response = urllib.request.urlopen(req, timeout=1.0) | ||
|
||
return response.read().decode("utf8") |
This file contains 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
This file contains 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