67 lines
1.8 KiB
Python
67 lines
1.8 KiB
Python
import requests
|
|
import json
|
|
import socket
|
|
import urllib3
|
|
|
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
|
|
HOSTNAME = "queue.workolik.com"
|
|
PHONE_IP = "125.21.240.67" # IP the phone resolved to
|
|
|
|
# Show what IP the PC resolves to
|
|
pc_ip = socket.gethostbyname(HOSTNAME)
|
|
print(f"\nPC resolves {HOSTNAME} to: {pc_ip}")
|
|
print(f"Phone resolved {HOSTNAME} to: {PHONE_IP}")
|
|
print(f"Same IP? {pc_ip == PHONE_IP}")
|
|
|
|
payload = {
|
|
"logid": None,
|
|
"userid": 1036,
|
|
"partnerid": 44,
|
|
"shiftid": 1,
|
|
"logdate": "2026-04-27 17:27:32",
|
|
"login": "17:27:32",
|
|
"latitude": "11.005080",
|
|
"longitude": "76.950849",
|
|
"raw_latitude": "11.005081",
|
|
"raw_longitude": "76.950849",
|
|
"velocity_lat": "0.0000",
|
|
"velocity_lng": "0.0000",
|
|
"speed": "0.00",
|
|
"heading": "0.00",
|
|
"onduty": 1,
|
|
"status": "idle",
|
|
"contactno": "8072675538",
|
|
"tenantid": 0,
|
|
"locationid": 0,
|
|
"applocationid": 1,
|
|
"userfcmtoken": "abc123",
|
|
"orderid": "1-20232131",
|
|
"username": "Vignesh S",
|
|
"firstname": "Vignesh",
|
|
"lastname": "S"
|
|
}
|
|
|
|
headers = {"Content-Type": "application/json", "Accept": "application/json"}
|
|
|
|
tests = [
|
|
("Via hostname (normal)", f"https://{HOSTNAME}/live/api/v2/partners/createriderlog"),
|
|
("Direct to phone IP (125.21.240.67)", f"https://{PHONE_IP}/live/api/v2/partners/createriderlog"),
|
|
]
|
|
|
|
for label, url in tests:
|
|
print(f"\n{'='*60}")
|
|
print(f"Test: {label}")
|
|
print(f"URL : {url}")
|
|
try:
|
|
h = dict(headers)
|
|
if PHONE_IP in url:
|
|
h["Host"] = HOSTNAME # tell Nginx the virtual host
|
|
r = requests.post(url, json=payload, headers=h, verify=False, timeout=10)
|
|
print(f"Status : {r.status_code}")
|
|
print(f"Response: {r.text[:300]}")
|
|
except Exception as e:
|
|
print(f"ERROR: {e}")
|
|
|
|
print(f"\n{'='*60}\nDone.")
|