Skip to content

Instantly share code, notes, and snippets.

@codekaust
Created September 13, 2020 19:17
Show Gist options
  • Save codekaust/ee51be677d0185a8ca1b480bbcfd722e to your computer and use it in GitHub Desktop.
Save codekaust/ee51be677d0185a8ca1b480bbcfd722e to your computer and use it in GitHub Desktop.
a = {
"start_time": "22:59:25",
"end_time": "23:59:25",
"date": "2020-09-13",
"location": "null",
"is_cancelled": "False",
"teacher": 1,
"subject": 1,
"batches": [
1,
2,
3,
4,
5,
6
]
}
import copy
i =0
l = []
while i< 22:
a["start_time"] = str(i)+":59:25"
a["end_time"] = str(i+1)+":30:25"
l.append(copy.deepcopy(a))
i+=4
j = []
for x in l:
i=13
p = []
while i<22:
t = copy.deepcopy(x)
t["date"] = "2020-09-"+str(i)
p.append(t)
i = i+1
# print(i)
j.extend(p)
l.extend(j)
# print(l)
import requests
url = "https://backend.mypathshala.net/classes/center_admin/"
for _ in l:
payload = str(_).replace('\'','\"')
headers = {
'Authorization': 'Token 43db76a3fea098c5dfb2ad701a46725a6d275426',
'Content-Type': 'application/json',
'Cookie': '__cfduid=dba483ef19814f22a8ee767ddfc0f2bc71598012445; csrftoken=5P3rQg6KNUyVItY4mRDeMa51hUnus4I2Jg3DWIChM2hkTf8d8l97EBHE6Lhvv1ig; cf_ob_info=502:5d24120f7f6a06b2:LHR; cf_use_ob=443'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
# a = []
# for i in range(1343):
# a.append({
# "id":i
# })
# print(str(a).replace('\'','\"'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment