18.08.2017, 19:05
Is it possible to fetch HTTPS resource from PAWN? HTTP returns HTTP_ERROR_BAD_HOST code.
import requests APP_ID = 'b1b15e88fa797225412429c1c50c122a1' API_URL = 'http://samples.openweathermap.org/data/2.5' CITY = 'Paris' def OnPlayerCommandText(playerid, cmdtext): if cmdtext == '/weather': response = requests.get( '{API_URL}/weather?q={CITY}&appid={APP_ID}'.format( **globals() ) ) return SendClientMessage( playerid, 0x00FFFFFF, 'The weather in {CITY} is "{description}"'.format( description=response.json()['weather'][0]['description'], **globals() ) )