import subprocess def _main(): host = "markets.api.uat.cmegroup.com" port = "443" # AUTH_ENDPOINT="$host/marketdatastream/v1" AUTH_ENDPOINT = 'https://authnr.cmegroup.com/as/token.oauth2' API_KEY = "API_THINKALPHA123" API_SECRET = '$MM9Rn*#qYARY$$QTMA#AMn*' # Define your API key and secret # API_KEY="YOUR_API_KEY" # API_SECRET="YOUR_API_SECRET" # Define the authentication API endpoint URL # AUTH_ENDPOINT="https://api.example.com/auth" # Perform the POST request and capture the response # response=$(curl -s -X POST -d "api_key=$API_KEY&api_secret=$API_SECRET&grant_type=password&username=API_THINKALPHA123&password=$API_SECRET" "$AUTH_ENDPOINT") # subprocess.run('ls') subprocess.run( f'curl -s -X POST -d "grant_type=client_credentials&client_id={API_KEY}&client_secret={API_SECRET}" "{AUTH_ENDPOINT}"', ) # curl --user 'API_THINKALPHA123:$MM9Rn*#qYARY$$QTMA#AMn*' 'https://query-api.datamine.cmegroup.com/v3/query/query_order_record?tradedate=2023-07-10&fields=symbol,transacttime,instrumentsequencenumber,tradeprice,tradequantity,tradeflag&q=asset.eq.TN,securitytype.eq.FUT,tradeflag.nin.OBS&fileFormat=csv&securityexchange=XCBT&underlyingproduct=Interest%20Rate' if __name__ == '__main__': _main()