Skip to content

Commit 8a098a5

Browse files
authored
Merge pull request #24 from flaker/master
API-3187 - Merge develop into customer
2 parents 9f3ebae + 50a9728 commit 8a098a5

File tree

7 files changed

+519
-233
lines changed

7 files changed

+519
-233
lines changed

History.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
0.5.0 / 2015-07-26
2+
==================
3+
* Replaced: urllib2 with requests package
4+
* Replaced: oauth2 with requests_oauthlib package
5+
* Added: optional timeout parameter
6+
* Removed: support for Python 2.4/2.5
7+
8+
0.4.0 / 2013-07-23
9+
==================
10+
* Added handling for API v2
11+
* Refined docstrings throughout code
12+
113
0.3.1 / 2013-06-04
214
==================
315
* Removed: Realm Support

README.md

+28-20
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,61 @@
11
# ox3apiclient
22

3-
A small class to help connect to the OpenX Enterprise API. While it uses [oauth2](https://github.com/simplegeo/python-oauth2),
4-
it does not use [httplib2](http://code.google.com/p/httplib2/) as the transport due to issues with headers created by
5-
httplib2. Instead it uses urllib2 as the HTTP transport.
3+
A small class to help connect to the OpenX Enterprise API. As of version 0.5.0 it uses
4+
[requests_oauthlib](https://github.com/requests/requests-oauthlib) instead of oauth2.
65

7-
It currently supports Python 2.4 - 2.7, with 3.x support comming in the future.
6+
It currently supports Python 2.6 - 2.7, with 3.x support coming in the future.
7+
8+
As of version 0.4.0, ox3apiclient supports API v2. If your instance is v2,
9+
set the api_path option to "/ox/4.0".
10+
11+
As of version 0.5.0 the client.request method returns a requests.Response object instead of
12+
urllib2.Response and throws a requests.exceptions.HTTPError instead of urllib2.HTTPError.
13+
In addition debugging is now available via the standard python logging facility.
14+
15+
See the [requests documentation](http://docs.python-requests.org/en/latest/) for details.
816

917
Basic usage:
1018

1119
````python
1220
import ox3apiclient
21+
import logging
1322

1423
ox = ox3apiclient.client_from_file().logon()
1524

16-
account_ids = ox.get('/a/account')
25+
ox.logger.setLevel(logging.DEBUG)
26+
ch = logging.StreamHandler()
27+
ch.setLevel(logging.DEBUG)
28+
ox.logger.addHandler(ch)
29+
30+
accounts = ox.get('/account')
1731

1832
order = {
1933
'status': 'Active',
2034
'name': 'OX3APIClient Object Creation Test',
21-
'account_id': account_ids[0],
22-
'start_date': '2012-08-22 00:00:00'}
35+
'account_uid': accounts['objects'][0]['account_uid'],
36+
'start_date': '2016-06-01 00:00:00'}
2337

24-
new_order = ox.post('/a/order', data=order)
38+
new_order = ox.post('/order', data=order)
2539

26-
ox.delete('/a/order/%s' % new_order['id'])
40+
ox.delete('/order/%s' % new_order['uid'])
2741

2842
ox.logoff()
2943
````
3044

3145

3246
## Installation
3347

34-
Install from [PyPi](http://pypi.python.org/pypi) with [pip](http://www.pip-installer.org/en/latest/index.html)
48+
ox3apiclient is currently unavailable at [PyPi](http://pypi.python.org/pypi) so just clone our git repo:
3549

3650
````
37-
$ pip install ox3apiclient
38-
````
39-
This should install the [oauth2](https://github.com/simplegeo/python-oauth2) dependency, but you can manually install if needed.
40-
````
41-
$ pip install oauth2
51+
$ git clone https://github.com/openx/OX3-Python-API-Client.git
4252
````
4353

44-
Note that Python 2.4 and 2.5 support requires simplejson. You will need
45-
simplejson 2.1.0 specifically for Python 2.4. You can install this version with:
54+
Install the downloaded library:
4655
````
47-
$ pip install simplejson==2.1.0
56+
python setup.py install
4857
````
49-
58+
this will install the current dependencies.
5059

5160
## Authentication
5261

@@ -102,4 +111,3 @@ ox = ox3apiclient.Client(
102111

103112
ox.logon(email, password)
104113
````
105-
Test

0 commit comments

Comments
 (0)