For OpenX Reporting access using the Python API Client you will need: (examples come from an Ubuntu machine)
- consumer_key,
- consumer_secret,
- email address and password for your user of your OpenX instance.
Update the package list
$ sudo apt update
Install pip and pipenv
$ sudo apt install python3-pip python3-dev
$ pip3 install --user pipenv
Add pipenv (and other python scripts) to PATH
$ echo 'PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc
$ source ~/.bashrc
Run the following command in your working directory
$ pipenv shell
$ git clone https://github.com/openx/ODS-Python-API-Client
$ python setup.py install
Now, set up your Python API Client.
The "settings" variable is responsible for the request body; in there you can place any specific dates / hours / attributes and metrics that will define your report. That particular example uses "Inv_perf_pub" report template for the 15th of June 2019. For more information visit http://openxcorporate-ui3.openxenterprise.com/data/1.0/ods.html .
If you want to find out what is the date range available for the selected report - please make sure you have the same metrics and attributes in the "data_range" variable as you have in the "settings" variable.
The "settings" variable is responsible for the request body; in there you can place specific attributes to create any UI item, e.g. an ad unit. For more information visit https://docs.openx.com/Content/developers/platform_api/api_ref.html
- 'pull_fields.py' to see all the available fields
$ python pull_fields.py
- 'date_range.py' to check what is the available date range for selected report (earliest possible StartData, closest possible EndDate)
$ python pull_report.py
- 'pull_reports.py' to pull your report
$ python pull_report.py
- 'ox_post.py' to send a request to our legacy endpoint, can be used to create UI items, e.g. an ad unit.
$ python ox_post.py