Calling Python gurus - need help getting Navigation Data Service to work?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SimonN
    Junior Member
    • Dec 2014
    • 71

    #1

    Calling Python gurus - need help getting Navigation Data Service to work?

    This is my code so far..

    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]
    Last edited by SimonN; 14-03-2016, 10:51 PM.
  • betdynamics
    Junior Member
    • Sep 2010
    • 534

    #2
    What response do you get when you make the call?

    i.e. if a json response is received, what does it contain?

    Comment

    • SimonN
      Junior Member
      • Dec 2014
      • 71

      #3
      Hi BetDynamics,

      My apologies for taking so long to reply.

      Good news is got it working returning the correct JSON string. Played around with that many different things not entirely sure which thing I did made it work.

      Now I am trying to get it working with gzip compression.

      Comment

      Working...
      X