forked from jatin-dot-py/zomato-intelligence
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdesync_contacts.py
More file actions
40 lines (34 loc) · 1.3 KB
/
desync_contacts.py
File metadata and controls
40 lines (34 loc) · 1.3 KB
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
import requests
def desync_contacts(zomato_token, proxies=None):
"""
Execute desync contacts request.
Returns dict with success status and response data.
"""
url = "https://api.zomato.com/gw/user-preference/recommendation/unsync-contacts"
headers = {
"Accept": "image/webp",
"Accept-Encoding": "gzip, deflate, br",
"Connection": "keep-alive",
"Content-Type": "application/json; charset=UTF-8",
"Host": "api.zomato.com",
"X-Zomato-Access-Token": zomato_token,
"X-Zomato-API-Key": "7749b19667964b87a3efc739e254ada2",
"X-Zomato-App-Version": "931",
"X-Zomato-App-Version-Code": "1710019310",
"X-Zomato-Client-Id": "5276d7f1-910b-4243-92ea-d27e758ad02b"
}
payload = {}
try:
response = requests.post(url, json=payload, headers=headers, proxies=proxies, verify=True if not proxies else False)
success = response.status_code >= 200 and response.status_code < 300
return {
'success': success,
'status_code': response.status_code,
'response': response.json() if response.text else None
}
except Exception as e:
return {
'success': False,
'status_code': None,
'error': str(e)
}