Skip to content

Instantly share code, notes, and snippets.

@vousmeevoyez
Created February 19, 2025 04:54
Show Gist options
  • Save vousmeevoyez/5ab6c2f07147ec64eca8f8c60163dac5 to your computer and use it in GitHub Desktop.
Save vousmeevoyez/5ab6c2f07147ec64eca8f8c60163dac5 to your computer and use it in GitHub Desktop.
JNT TARIF CHECK
import requests
import json
import hashlib
import base64
customer = "HR"
key = "HR001188"
url = "http://jk.jet.co.id:22230/jandt_track/inquiry.action"
data = {
"cusName": customer,
"sendSiteCode": "JAKARTA",
"destAreaCode": "JOGONALAN",
"productType": "EZ",
"weight": 1,
}
data_json = json.dumps(data, separators=(',', ':'))
md5_hash = hashlib.md5((data_json + key).encode()).hexdigest()
sign = base64.b64encode(md5_hash.encode()).decode()
data_request = {
"data": data_json,
"sign": sign,
}
print(data_request)
headers = {
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, headers=headers, data=data_request)
print(response.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment