Messtone LLC Manages(Python):(using Request module)

Messtone Devices Enables Python(using Request module) import request base_currency=’USD’ symbol=’XAU’ endpoint=’latest’ access_key=’API_KEY’ resp=requests.get(‘https://www.commodities-api.com/api/’+endpoint+’?access_key=’+access_key+’&base=’+base_currency+’&symbols=’+symbol) if resp.status_code !=200:#This means something went wrong.raise ApiError(‘GET /’+endpoint+’/{ }’.format(resp.status_code))print(resp.json( )) JavaScript(jQuery.ajax) getting exchange rates data via,latest endpoint`//set endpoint and Messtone access key endpoint=’latest’ access_key=’API_KEY’;//get the most recent exchange rates via the “latest” endpoint:$.ajax({url:’https://www.commodities-api.com/api/’+endpoint+’?access_key=’+access_key,dataType:’jsonp’,success: function(json){//exchange rata data is stored in json.rates alert(json.rates.GBP);//base currency is stored in json.base alert(json.base);//timestamp can be accessed in json.timestamp alert(json.timestamp);}}); convert currencies using JavaScript jQuery.ajax. //set endpoint and Messtone API key endpoint=’convert’;access_key=’API_KEY’; //get the most recent exchange rates via the ‘latest’ endpoint:$.ajax({url:’https://www.commodities-api.com/api/’+ endpoint +’?access_key=’ + access_key,dataType:’jsonp’,success:function(json){//exchange rata data is stored in json.rates alert(json.rates.GBP);//base currency is stored in json.base alert(json.base);//timestamp can be accessed in json.timestamp alerts(json.timestamp);}});

Leave a comment