This is my code so far..
Am new to Python and can't nail this down yet ... much appreciated...
Am new to Python and can't nail this down yet ... much appreciated...
Code:
[SIZE="1"]import urllib.request as urllib2
url = 'https://api.betfair.com/exchange/betting/rest/v1/en/navigation/menu.json/'
headers = {'X-Application': APPKEY, 'X-Authentication': SESSION, 'content-type': 'application/json', 'accept': 'application/json', 'accept-encoding': 'gzip,deflate'}
def callAping(url):
try:
req = urllib2.Request(url, request, headers)
response = urllib2.urlopen(req)
jsonResponse = response.read()
return jsonResponse
except urllib2.URLError:
print 'Oops there is some issue with the request'
exit()
except urllib2.HTTPError:
print 'Oops there is some issue with the request' + urllib2.HTTPError.getcode()
exit()[/SIZE]


Comment