-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
25 lines (23 loc) · 930 Bytes
/
test.py
File metadata and controls
25 lines (23 loc) · 930 Bytes
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
import os
import requests
server = 'https://algoapirubin.eu.pythonanywhere.com/telebot/'
client = requests.session()
photo_path = "swagga1337 118.jpg"
for i in range(25):
i += 1
data = dict(tg_url="tg_url", tg_name="tg_name", name="name" + str(i), description="description",
agent_name="AlgoApi", next='/')
if photo_path != "False":
with open(os.path.join("src\\downloads\\" + photo_path), 'rb') as pfile:
try:
r = client.post(url=server, data=data, files={'photo': pfile},
headers=dict(Referer=server))
except ConnectionError as r:
print("CONNECTION TERMINATED")
else:
try:
r = client.post(url=server, data=data,
headers=dict(Referer=server))
except ConnectionError as r:
print("CONNECTION TERMINATED")
print(str(r) + "DEBUG")