Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bet fairs navigation data for applications #47

Open
goetzk opened this issue Jun 29, 2015 · 1 comment
Open

Support bet fairs navigation data for applications #47

goetzk opened this issue Jun 29, 2015 · 1 comment

Comments

@goetzk
Copy link
Contributor

goetzk commented Jun 29, 2015

While I only have medium term plans for the data provided, i thought support for the bet fair supplied navigation data might be a handy thing to have in the library.

https://api.developer.betfair.com/services/webapps/docs/display/1smk3cen4v3lu3yomq5qye0ni/Navigation+Data+For+Applications

@primal100
Copy link

This is a basic start to retrieving the data:

  import StringIO
  import gzip

  self.navigationurl = 'https://api.betfair.com/exchange/betting/rest/v1/en/navigation/menu.json'

  def downloadNavigationData(self):
        request = urllib2.Request(self.navigationurl)
        request.add_header('Accept-encoding', 'gzip')
        request.add_header("X-Application", self.app_key)
        request.add_header("X-Authentication", self.session_token)
        opener = urllib2.build_opener()
        f = opener.open(request)
        c_data = f.read()
        c_stream = StringIO.StringIO(c_data)
        gzipper = gzip.GzipFile(fileobj=c_stream)
        data = gzipper.read()
        json_data = json.loads(data)
        return json_data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants