-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate-update.py
More file actions
37 lines (21 loc) · 890 Bytes
/
Copy pathvalidate-update.py
File metadata and controls
37 lines (21 loc) · 890 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
26
27
28
29
30
31
32
33
34
35
36
37
import requests
client_id = "y25R7Si0cQFdrTqpwoD"
file_name= "zalando1.csv"
headers = {
'x-api-key': "GusfAW9hKrR4QEDQ7ck3zIhYgEqTduLi3Ce8kSZi",
'content-type': "application/csv",
'cache-control': "no-cache"
}
with open('zalando1.csv', 'rb') as f:
res = requests.put(f"https://merchants-connector-importer.zalandoapis.com/{client_id}/validate".format(client_id=client_id), headers=headers, data=f.read())
print(res.json())
if res.status_code == 200:
print("Success validate")
res = requests.put(f"https://merchants-connector-importer.zalandoapis.com/{client_id}/{file_name}".format(client_id=client_id), headers=headers, data=f.read())
if res.status_code == 200:
print("Success update")
else:
print("Failed validate")
print(res.json())
else:
print("Failed validate")