A client library for interacting with the OpenX Reporting API, providing both Python and Bash implementations for:
- OAuth2 authentication with the OpenX API
- Report generation
- Report retrieval and download
- Secure OAuth 2.0 authentication
- Report generation and pulling
- Available in both Python and Bash implementations
- Python 3.6+
- Required packages:
- requests
- curl
- jq
- openssl
from reporting_api_auth_client import AuthClient
# Create an authentication client
client = AuthClient(
client_id="YOUR_CLIENT_ID",
email="YOUR_EMAIL",
password="YOUR_PASSWORD",
instance_hostname="YOUR_INSTANCE_HOSTNAME"
)
# Get an authentication token
token = client.get_token()
# Run the report generation script
python reporting_api_report.py
To modify report parameters, edit the generate_report_parameters
dictionary in reporting_api_report.py
:
generate_report_parameters = {
"reportType": "HOURLY", # Options: HOURLY, DAILY
"dateFrom": "2025-06-01T00:00:00Z",
"dateTo": "2025-06-01T01:00:00Z",
"dimensions": ["Hour", "PageDomain"], # Dimensions to include in the report
"metrics": ["AllRequests"] # Metrics to include in the report
}
- Edit the configuration section in
reporting_api_report.sh
:
# ---- CONFIG ----
CLIENT_ID="your_client_id"
EMAIL="your_email"
PASSWORD="your_password"
INSTANCE_HOSTNAME="your_instance_hostname"
- Make the script executable:
chmod +x reporting_api_report.sh
- Run the script:
./reporting_api_report.sh
To see help information:
./reporting_api_report.sh --help
Both implementations save the report as a CSV file named report.csv
in the current directory.
- Store your actual credentials securely and never commit them to version control.
This project is licensed under the MIT License - see the LICENSE file for details.