Skip to content

Commit 50a9728

Browse files
author
Federico Delgado
committed
API-3187 merge develop into master
2 parents b8e816c + e7ec06e commit 50a9728

File tree

7 files changed

+450
-252
lines changed

7 files changed

+450
-252
lines changed

History.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
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+
18
0.4.0 / 2013-07-23
29
==================
310
* Added handling for API v2

README.md

+26-20
Original file line numberDiff line numberDiff line change
@@ -1,55 +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.
87

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

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.
16+
1217
Basic usage:
1318

1419
````python
1520
import ox3apiclient
21+
import logging
1622

1723
ox = ox3apiclient.client_from_file().logon()
1824

19-
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')
2031

2132
order = {
2233
'status': 'Active',
2334
'name': 'OX3APIClient Object Creation Test',
24-
'account_id': account_ids[0],
25-
'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'}
2637

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

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

3142
ox.logoff()
3243
````
3344

3445

3546
## Installation
3647

37-
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:
3849

3950
````
40-
$ pip install ox3apiclient
41-
````
42-
This should install the [oauth2](https://github.com/simplegeo/python-oauth2) dependency, but you can manually install if needed.
43-
````
44-
$ pip install oauth2
51+
$ git clone https://github.com/openx/OX3-Python-API-Client.git
4552
````
4653

47-
Note that Python 2.4 and 2.5 support requires simplejson. You will need
48-
simplejson 2.1.0 specifically for Python 2.4. You can install this version with:
54+
Install the downloaded library:
4955
````
50-
$ pip install simplejson==2.1.0
56+
python setup.py install
5157
````
52-
58+
this will install the current dependencies.
5359

5460
## Authentication
5561

@@ -104,4 +110,4 @@ ox = ox3apiclient.Client(
104110
consumer_secret=consumer_secret)
105111

106112
ox.logon(email, password)
107-
````
113+
````

0 commit comments

Comments
 (0)