import requests
API_KEY = "TAKION_API_XXXX"
url = "https://api.bbw.com/payments/v2/giftcard"
payload = {
"lbCustomerID": "abyQtuW2FurvCkyKA3h2cLxUMh",
"email": "[email protected]",
"brand": "BBW",
}
def send_request_without_headers():
headers = {
"accept-language": "it-IT,it;q=0.9",
"accept-charset": "UTF-8",
"accept": "*/*",
"content-type": "application/json",
}
response = requests.post(
url,
json=payload,
headers=headers
)
print(
f"Response without headers: {response.status_code} / {response.text}")
def send_request_with_headers():
px_headers = requests.post(
"https://px-mobile.takionapi.tech/generate",
json={"package_name": "com.bathandbody.bbw", "manufacturer": "samsung"},
params={"api_key": API_KEY}
).json()
headers = {
"accept-language": "it-IT,it;q=0.9",
"accept-charset": "UTF-8",
"accept": "*/*",
"content-type": "application/json",
} | px_headers
print(px_headers)
exit(0)
response = requests.post(
url,
json=payload,
headers=headers
)
print(f"Response with headers: {response.status_code} / {response.text}")
if __name__ == "__main__":
send_request_without_headers()
print(" -------------------- ")
send_request_with_headers()