ox3apiclient

Client to connect to OpenX Enterprise API
Download

ox3apiclient Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Other/Proprietary Li...
  • Price:
  • FREE
  • Publisher Name:
  • Tony Edwards
  • Publisher web site:
  • https://github.com/tnydwrds/

ox3apiclient Tags


ox3apiclient Description

ox3apiclient is a small class to help connect to the OpenX Enterprise API. While it uses oauth2, it does not use httplib2 as the transport due to issues with headers created by httplib2. Instead it uses urllib2 as the HTTP transport.It currently supports Python 2.4 - 2.7, with 3.x support comming in the future.Basic usage:import ox3apiclientox = ox3apiclient.client_from_file().logon()account_ids = ox.get('/a/account')order = { 'status': 'Active', 'name': 'OX3APIClient Object Creation Test', 'account_id': account_ids, 'start_date': '2012-08-22 00:00:00'}new_order = ox.post('/a/order', data=order)ox.delete('/a/order/%s' % new_order)ox.logoff()InstallationInstall from PyPi with pip pip install ox3apiclientThis should install the oauth2 dependency, but you can manually install if needed. pip install oauth2Note that Python 2.4 and 2.5 support requires simplejson. You will need simplejson 2.1.0 specifically for Python 2.4. You can install this version with: pip install simplejson==2.1.0AuthenticationThe 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:envs= dev prodemail: you@example.compassword: password123domain: dev.uidomain.comrealm: dev.uidomain_realmconsumer_key: 1fc5c9ae...consumer_secret: 7c664d68...authorization_url: http://custom_sso.uidomain.com/api/index/initiateemail: you@example.compassword: password123domain: uidomain.comrealm: uidomain_realmconsumer_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 = 'you@example.com'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)Product's homepage


ox3apiclient Related Software