import json import requests # tutorial source: https://www.digitalocean.com/community/tutorials/how-to-use-web-apis-in-python-3 api_key = 'your_api_key' api_url = 'https://faras.io/api_newinvoice/' headers = {'Content-Type': 'application/json'} products = [{'ProductName': 'طاولة طعام', 'Quantity': 4, 'Price': 55.5 }] customer = { "Name": "سامي محمد", "PhoneNumber": 966555555555, "ID":45886, "Email": "test@example.com", } json_req = { "Key": api_key, "Products":products , "Customer": customer, "TestMode": 1 } print("Printing response for a sample call to /api_newinvoice/ :") response = requests.post(api_url, headers=headers, json=json_req) result = json.loads(response.content) for key, value in result.items(): print (key, value)