-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
54 lines (40 loc) · 1.23 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import requests
from datetime import datetime as dt
PIXELA_ENDPOINT = "https://pixe.la/v1/users"
USERNAME = "ishanr1"
TOKEN = "eyvedvqlqeyge2764vdkkdhbdieh"
# randomly generated
GRAPHID = "graph2"
GRAPH_ENDPOINT = f"https://pixe.la/v1/users/{USERNAME}/graphs/{GRAPHID}/"
ADD_PIXEL_ENDPOINT = f"{PIXELA_ENDPOINT}/{USERNAME}/graphs/{GRAPHID}"
PARAMETERS = {
"token": "eyvedvqlqeyge2764vdkkdhbdieh",
"username": "ishanr1",
"agreeTermsOfService": "yes",
"notMinor": "yes"
}
GRAPH_PARAMS = {
"id": GRAPHID,
"name": "Workout Graph",
"unit": "Pump",
"type": "int",
"color": "momiji"
}
today = dt.now()
PIXEL_PARAMS = {
"date": today.strftime("%Y%m%d"),
"quantity": input("How was your workout today? (1-10)")
}
headers = {
"X-USER-TOKEN": TOKEN
}
# Create a user
# response = requests.post(url=PIXELA_ENDPOINT, json=PARAMETERS)
# print(response.text)
# Create a graph
# response = requests.post(url=GRAPH_ENDPOINT, json=GRAPH_PARAMS, headers=headers)
# print(response.text)
# Add a pixel
response = requests.post(url=ADD_PIXEL_ENDPOINT, json=PIXEL_PARAMS, headers=headers)
print(response.text)
# a system where users get nnotified every day to record their activity and that gets stored as a pixel