GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - openx/OX3-Python-API-Client: Helper class for accessing the OX3 API - Requires https://github.com/simplegeo/python-oauth2

This repository was archived by the owner on Oct 14, 2026. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

152 Commits
152 Commits

Folders and files

NameName
Last commit message
Last commit date
ox3apiclient
ox3apiclient
 
 
requirements
requirements
 
 
test
test
 
 
.gitignore
.gitignore
 
 
History.md
History.md
 
 
LICENSE.txt
LICENSE.txt
 
 
MANIFEST.in
MANIFEST.in
 
 
README.md
README.md
 
 
setup.cfg
setup.cfg
 
 
setup.py
setup.py
 
 

Repository files navigation

ox3apiclient

A small class to help connect to the OpenX Enterprise API. As of version 0.5.0 it uses requests_oauthlib instead of oauth2.

It currently supports Python 2.6 - 3.5.

As of version 0.4.0, ox3apiclient supports API v2. If your instance is v2, set the api_path option to "/ox/4.0".

As of version 0.5.0 the client.request method returns a requests.Response object instead of urllib2.Response and throws a requests.exceptions.HTTPError instead of urllib2.HTTPError. In addition debugging is now available via the standard python logging facility.

See the requests documentation for details.

Basic usage:

import ox3apiclient
import logging

ox = ox3apiclient.client_from_file().logon()

ox.logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
ox.logger.addHandler(ch)

accounts = ox.get('/account')

order = {
    'status': 'Active',
    'name': 'OX3APIClient Object Creation Test',
    'account_uid': accounts['objects'][0]['account_uid'],
    'start_date': '2016-06-01 00:00:00'}

new_order = ox.post('/order', data=order)

ox.delete('/order/%s' % new_order['uid'])

ox.logoff()

Installation

From Pypi

The last released version (from the master branch) is available at PyPi

$ pip install ox3apiclient

From Github:

Just clone our git repo:

$ git clone https://github.com/openx/OX3-Python-API-Client.git

Install the downloaded library:

python setup.py install

this will install the current dependencies.

Authentication

The recommended method of authentication is to use ox3apiclient.client_from_file. By default this will look for a file named .ox3rc in the current current directory, but this can be overwritten by specifying a file_path parameter. The file should be in the following format:

[ox3apiclient]
envs=
    dev
    prod

[dev]
email: [email protected]
password: password123
domain: dev.uidomain.com
realm: dev.uidomain_realm
consumer_key: 1fc5c9ae...
consumer_secret: 7c664d68...
authorization_url: http://custom_sso.uidomain.com/api/index/initiate

[prod]
email: [email protected]
password: password123
domain: uidomain.com
realm: uidomain_realm
consumer_key: 1fc5c9ae...
consumer_secret: 7c664d68...

ox3apiclient.client_from_file will use the first env by default but this can be overwritten by setting the env parameter. If your email and password are set in .ox3rc you can simply chain a call to logon().

Alternatively you can set everything in your code.

email = '[email protected]'
password = 'password123'
domain = 'uidomain.com'
realm = 'uidomain_realm'
consumer_key = '1fc5c9ae...'
consumer_secret = '7c664d68...'

ox = ox3apiclient.Client(
    email=email,
    password=password,
    domain=domain,
    realm=realm,
    consumer_key=consumer_key,
    consumer_secret=consumer_secret)

ox.logon(email, password)
# To run these tests. Install nose (pip install nose)
# and run nosetests -sxv tests/  from the root dir

Tests

Install nose

pip install nose

and run the following command line from the root:

nosetests -sxv tests/

About

Helper class for accessing the OX3 API - Requires https://github.com/simplegeo/python-oauth2

Resources

Readme
License
Activity
Custom properties

Stars

8 stars

Watchers

35 watching

Forks

15 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.