RTB House SDK
Project description
Overview
This library provides an easy-to-use Python interface to RTB House API. It allows you to read and manage you campaigns settings, browse offers, download statistics etc.
API docs: https://api.panel.rtbhouse.com/api/docs
Installation
RTB House SDK can be installed with pip:
$ pip install rtbhouse_sdk
Usage example
Let’s write a script which fetches campaign stats (imps, clicks, postclicks) and shows the result as a table (using tabulate library).
First, create config.py file with your credentials:
USERNAME = 'jdoe' PASSWORD = 'abcd1234'
Set up virtualenv and install requirements:
$ pip install rtbhouse_sdk tabulate
from datetime import date, timedelta
from operator import attrgetter
from rtbhouse_sdk.client import BasicAuth, Client
from rtbhouse_sdk.schema import CountConvention, StatsGroupBy, StatsMetric
from tabulate import tabulate
from config import PASSWORD, USERNAME
if __name__ == "__main__":
with Client(auth=BasicAuth(USERNAME, PASSWORD)) as api:
advertisers = api.get_advertisers()
day_to = date.today()
day_from = day_to - timedelta(days=30)
group_by = [StatsGroupBy.DAY]
metrics = [
StatsMetric.IMPS_COUNT,
StatsMetric.CLICKS_COUNT,
StatsMetric.CAMPAIGN_COST,
StatsMetric.CONVERSIONS_COUNT,
StatsMetric.CTR
]
stats = api.get_rtb_stats(
advertisers[0].hash,
day_from,
day_to,
group_by,
metrics,
count_convention=CountConvention.ATTRIBUTED_POST_CLICK,
)
columns = group_by + metrics
data_frame = [
[getattr(row, c.name.lower()) for c in columns]
for row in reversed(sorted(stats, key=attrgetter("day")))
]
print(tabulate(data_frame, headers=columns))
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rtbhouse_sdk-15.0.0.tar.gz.
File metadata
- Download URL: rtbhouse_sdk-15.0.0.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74de3cbe3617e9a9e6a83545e91d5535b29ae5f49e6f259dc481ec37dc886e09
|
|
| MD5 |
f7b6ebf59b58da9797c5033a537a45b7
|
|
| BLAKE2b-256 |
56019bcbf6ca770da94878bd99a1064530c034e904d94f881d8ba27c80392fb1
|
Provenance
The following attestation bundles were made for rtbhouse_sdk-15.0.0.tar.gz:
Publisher:
ci.yaml on rtbhouse-apps/rtbhouse-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rtbhouse_sdk-15.0.0.tar.gz -
Subject digest:
74de3cbe3617e9a9e6a83545e91d5535b29ae5f49e6f259dc481ec37dc886e09 - Sigstore transparency entry: 804612858
- Sigstore integration time:
-
Permalink:
rtbhouse-apps/rtbhouse-python-sdk@2b0956ee0856ec4f44dafe6952798dde7920e66b -
Branch / Tag:
refs/heads/master - Owner: https://github.com/rtbhouse-apps
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@2b0956ee0856ec4f44dafe6952798dde7920e66b -
Trigger Event:
push
-
Statement type:
File details
Details for the file rtbhouse_sdk-15.0.0-py3-none-any.whl.
File metadata
- Download URL: rtbhouse_sdk-15.0.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1653675185451092bbde26392afb5bcfca76165902c76bf87fc4f8a01f7a752b
|
|
| MD5 |
a91bb69bf532accefa0c4fa544c112b6
|
|
| BLAKE2b-256 |
ecc60ab5401cefd1db8509dd112e15bb87e256a7c69f8174613f5ca377b1c9bd
|
Provenance
The following attestation bundles were made for rtbhouse_sdk-15.0.0-py3-none-any.whl:
Publisher:
ci.yaml on rtbhouse-apps/rtbhouse-python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rtbhouse_sdk-15.0.0-py3-none-any.whl -
Subject digest:
1653675185451092bbde26392afb5bcfca76165902c76bf87fc4f8a01f7a752b - Sigstore transparency entry: 804612864
- Sigstore integration time:
-
Permalink:
rtbhouse-apps/rtbhouse-python-sdk@2b0956ee0856ec4f44dafe6952798dde7920e66b -
Branch / Tag:
refs/heads/master - Owner: https://github.com/rtbhouse-apps
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@2b0956ee0856ec4f44dafe6952798dde7920e66b -
Trigger Event:
push
-
Statement type: