Skip to main content

Targeting Platform

Pypi Version Python Version License

Prerequsites

To use module following tools need to be configured:

  • Redis - is used for caching platform information (catalog of lineitems/adgroups e.g.) and locks. It depends on amount of information in your platform but as a starting point 1Gb memory will be enough. For now only single entrypoint is supported. Prefix for cache keys is PLATFORM_CACHE_ (set in CACHE_KEYS_PREFIX) and for locks PLATFORM_LOCK_ (LOCK_KEYS_PREFIX).

Credentials for platforms

Each platform has it's own format of credentials. You need to obtaint credetantial before starting to use platforms thorugh this module.

DV360 (dv360)

Requires service account private key (whole JSON for service account). E.g.

{
    "type": "service_account",
    "project_id": "",
    "private_key_id": "",
    "private_key": "-----BEGIN PRIVATE KEY-----\n\n-----END PRIVATE KEY-----\n",
    "client_email": "",
    "client_id": "",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://oauth2.googleapis.com/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_x509_cert_url": ""
}

Meta (Facebook) (meta)

Example of credentails (app_scoped_system_user_id is required for detailed access validation):

{
    "access_token": "",
    "app_scoped_system_user_id":
}

The Trade Desk (ttd)

Example of credentials (login and password is required for automatic token renewal):

{
    "PartnerId": "",
    "token": "",
    "Login": "",
    "Password": ""
}

Platforms

DV360

Library works as with normal lineitems as with YouTube through SDF. In case of passing lineitem id for YouTube (in array all ids should be either for normal or YouTube lineitems) methods will return Pandas DataFrame with prepared data - you need to get CSV from it and manually upload to Google.

Meta

While testing/using you can receive Rate Limit (set by Meta Marketing API) - you need to monitor your limits before operations. For current implementaion (probably will be chnaged in future releases) there is no retries and exceptions - you simply get empty result (means set/chnaged nothing).

The Trade Desk (TTD)

Setting locations (geofence) in Data Groups can take a time - about 45 minutes. It is how TTD operates - it takes seconds to create thousands of points in geofences, but about an hour while they will be availible to use (TTD API). In code we have expponential retries to repeat operations till success (do not be confused - 403 error does aslo mean "we can't find geofence" in terms of TTD) - so all you need to wait.

How to use

See examples in integration tests.

You can adopt these tests by placing appropriate sectet files into folder secrets.

Locks

To prevent simultanous updating of the same placements in the platform locks are used. While you are calling clear, pause, delete and set operations lock will be acquired and released in the end of the operation (or after 1 hour in case of any error). If method can't acquire lock it will return empty results (no exception raised).

Metadata

Release files for targeting-platform 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for targeting-platform 0.3.4
File Size Uploaded Provenance
targeting_platform-0.3.4.tar.gz 45.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for targeting-platform 0.3.4
File Interpreter ABI Platform
targeting_platform-0.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 92.2 kB

Release files / targeting_platform-0.3.4.tar.gz

Download URL targeting_platform-0.3.4.tar.gz
Size 45.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ca8c4e9f0ec4860d3a11b6eaa12c0b6adb97be9ed383b566a772d292b2996ecd
BLAKE2b-256 checksum
How to use checksums
09accbc744a4d5c0234b123f5bc3b9fa28f4bc8457864ee0aa1d3b57cec8bc6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.6

Release files / targeting_platform-0.3.4-py3-none-any.whl

Download URL targeting_platform-0.3.4-py3-none-any.whl
Size 46.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef8313a51ba88cdda46a7a39a8240f6d97603103bf362cd17cebfc4a02430cbf
BLAKE2b-256 checksum
How to use checksums
ae3e3cd41dee5e4d3a10711f08cecacdda7ff29b46d9314d86c7b01642fa58dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.6

Security for targeting-platform 0.3.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page