import requests from urllib.parse import urlencode # This Python script uses the requests library, which is a common library for making HTTP requests in Python. # You might need to install it using pip install requests if you haven't done so already. # ProductID nID = "40030x40050x40010" # Example value. Replace with actual logic to obtain this value from your data. # Quantity nQuantity = "1" # Example value. Adjust as necessary. # Database variables and fixed values sLogEmail = "yourLoginEmail@yourDomain.com" sLogPassword = "yourLoginPassword" sCustEmail = "yourcustomer@gmail.com" sCustName = "Jon Smith" sCo = "Customer Company Name" sCustAddress = "123 street, suite#2" sCustCity = "Apple Valley" sCustState = "MN" sCustZip = "55124" sCustCountry = "US" sSpecialText = "Put customer specific instructions here." sInvoice = "123ABC" nPrice = "12.95" bUsePriceOnCustomsForm = "0" sTypeShipping = "rtrackstandard" sMode = "test" # Form the URL strURL = "https://www.trepstar.com/custdata.asp" params = { "productID": nID, "ordermethod": "url", "quantity": nQuantity, "CoLoginEmail": sLogEmail, "CoLoginPassword": sLogPassword, "source": "cdfulfill", "mode": sMode, "email": sCustEmail, "name": sCustName, "nprice": nPrice, "bUsePriceOnCustomsForm": bUsePriceOnCustomsForm, "co": sCo, "addr": sCustAddress, "city": sCustCity, "st": sCustState, "zip": sCustZip, "typeMailMethod": sTypeShipping, "country": sCustCountry, "specialtext": sSpecialText, "invoice": sInvoice } # Encode the parameters and append them to the URL encoded_params = urlencode(params) full_url = f"{strURL}?{encoded_params}" try: # Make the web request with SSL verification enabled by default response = requests.get(full_url) # Check if the response status code indicates success if response.status_code == 200: print("

The Network call worked. Do something with the response text.

") if "[SUCCESS]" in response.text: print("Success: The following was returned from the server:
") else: print("Failure: The following was returned from the server:
") print("
") print(response.text) else: print(f"Request failed with status code: {response.status_code}") except requests.RequestException as e: print(f"An error occurred: {e}")