import requests
import json

# API endpoint
url = "https://mobileapi.puanharca.com/api/customer/card/point/check"

# Headers
headers = {
    "User-Agent": "Dart/3.7 (dart:io)",
    "Accept": "application/json",
    "Accept-Encoding": "gzip, deflate, br",
    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJGaXJzdE5hbWUiOiJzYWRpbiIsIkxhc3ROYW1lIjoic2FwaW4iLCJWZXJpZnlJZCI6IjZiODg1MzMwLWQwNzktNDA0MC1iNDQwLTU1MmE0MjhiM2NmMyIsIkNsYXJpdHlLZXkiOiIxa2dmdnciLCJleHAiOjE3OTU5MDE5MTgsImlzcyI6IlB1YW5IYXJjYSIsImF1ZCI6IkNsaWVudCJ9.U28Jzb83kZK_3UauwFyFZrUGdbkEhjG5Sonf4YZtPcE",
    "Content-Type": "application/json"
}

# Request body
data = {
    "CardHolderName": "born born",
    "CardNumber": "9792071001684954",
    "Month": "01",
    "Year": "2029",
    "Cvv": "588"
}

# Proxy configuration
proxies = {
    'http': 'http://ccb7t99f1xa6q6v:e88zmabjie6wuek@rp.scrapegw.com:6060',
    'https': 'http://ccb7t99f1xa6q6v:e88zmabjie6wuek@rp.scrapegw.com:6060'
}

# Make the POST request
try:
    # Note: requests automatically handles decompression
    response = requests.post(url, headers=headers, json=data, proxies=proxies)
    
    print(f"Status Code: {response.status_code}")
    print(f"\nResponse Headers:")
    for key, value in response.headers.items():
        print(f"  {key}: {value}")
    
    print(f"\nResponse Body:")
    try:
        # Force decoding if needed
        response.encoding = 'utf-8'
        print(json.dumps(response.json(), indent=2, ensure_ascii=False))
    except json.JSONDecodeError:
        print(response.text)
    except Exception as e:
        print(f"Could not parse response: {e}")
        print(f"Raw content: {response.content}")
        
except requests.exceptions.RequestException as e:
    print(f"Error occurred: {e}")
