Skip to content

Commit 52de544

Browse files
committed
Deployed
1 parent 4948720 commit 52de544

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

Habit Tracking/main.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import requests
2+
from datetime import datetime
3+
4+
pixela_endpoint = "https://pixe.la/v1/users"
5+
Token = "58e6d7c1-8e5a-4b4b-8e6d-586e5a4b4b4b"
6+
User= "shubhmrj"
7+
user_params = {
8+
"token": Token,
9+
"username":User ,
10+
"agreeTermsOfService": "yes",
11+
"notMinor": "yes"
12+
}
13+
14+
# response = requests.post(url=pixela_endpoint, json=user_params)
15+
# print(response.text)
16+
17+
graph_endpoint = f"{pixela_endpoint}/{User}/graphs"
18+
graph_config = {
19+
"id": "graph1",
20+
"name": "Cycling Graph",
21+
"unit": "Km",
22+
"type": "float",
23+
"color": "ajisai"
24+
}
25+
headers = {
26+
"X-USER-TOKEN": Token
27+
}
28+
# response=requests.post(url=graph_endpoint, json=graph_config , headers=headers)
29+
# print(response.text)
30+
31+
today=datetime.now().strftime("%Y%m%d")
32+
print(today)
33+
34+
date_config = {
35+
"date": today,
36+
"quantity": "7.5"
37+
}
38+
pixel_endpoint = f"{graph_endpoint}/graph1"
39+
# response=requests.post(url=pixel_endpoint, json=date_config , headers=headers)
40+
# print(response.text)
41+
update_endpoint = f"{pixel_endpoint}/{today}"
42+
upddate_config = {
43+
"quantity": "85"
44+
}
45+
# response=requests.put(url=update_endpoint, json=upddate_config , headers=headers)
46+
# print(response.text)
47+
48+
delete_endpoint = f"{pixel_endpoint}/{today}"
49+
response=requests.delete(url=delete_endpoint , headers=headers)
50+
print(response.text)

0 commit comments

Comments
 (0)