TODO: Put more badges here, such as Cloud Build Status
The new client for OpenX API, for Python apps
This package supersedes the ox3apiclient and contains a rewritten client
of OpenX API (OX API) for Python applications. It provides a wrapper for OAuth autenthication process
to log in into the OX API, and then wraps around standard requests, adding the auth headers.
In the future, we want to add some API autodiscovery to the client, and maybe a CLI app as a demo.
Table of Contents generated with DocToc
In order to use the OpenX Exchange API, which is a standard REST service, you need to authenticate through OAuth (as described in the docs). This library automates the process and simplifies it down to two things:
- instantiating the client with your client key/secret
- logging in as a user - either programatically or interactively (new!)
It makes the API usage as simple as:
import OXApiClient
api = OXApiClient('abc123def456ghi789jklABCmnoDEFpqrGHIstuJ', '987abc654def321ghi123abc234def567ghi890a',
'sso.openx.com', 'your_realm', 'your-ui.openx.net')
api.login() # interactive
# get root network account
example = api.get(f"/account?account_id=null").json()
master_id = example.get('objects')[0]['id']
print(f"My instance master network is under id {master_id}.")pip install oxapiclient # we've dropped the '3' from the name
Requirements:
- Code block illustrating how to install.
Subsections:
Dependencies. Required if there are unusual dependencies or dependencies that must be manually installed.Updating. Optional.
Suggestions:
- Link to prerequisite sites for programming language: npmjs, godocs, etc.
- Include any system-specific information needed for installation.
- If there is no code in the module - for instance, a document-based module - this section is not required.
The client does not log much by default, only some SimpleHTTPRequestHandler logs if using interactive login. If you want to debug your OAuth1 login, you can do
import logging
log = logging.getLogger("oauth1_session")
log.setLevel("DEBUG")Describe the development process.
make test
Describe how to test your project here, what test frameworks it uses and how would you like the tests to be written.
npm run
Requirements:
- Code block illustrating common usage.
- If CLI compatible, code block indicating common usage.
- If importable, code block indicating both import functionality and usage.
Status: Optional. Should be a separate document.
Requirements:
- Describe exported functions and objects.
Suggestions:
- Describe signatures, return types, callbacks, and events.
- Cover types covered where not obvious.
- Describe caveats.
- If using an external API generator (like go-doc, js-doc, or so on), point to an external
API.mdfile. This can be the only item in the section, if present.
- Core developer: Cezar Pokorski — This is the main project code owner, every major/architectural change should be agreed with them. Also consult for these scopes: project README, project python code.
- Backup developer: TheOther Person — Secondary contact for the project.
PRs accepted. General PR guidelines:
- x
- 🍻 Grzegorz Łyczba (kudos for Makefile template and standarization)
Commercial License © 2021 OpenX