# Targeting Platform
![Pypi Version](https://img.shields.io/pypi/v/targeting-platform)
![Python Version](https://img.shields.io/pypi/pyversions/targeting-platform)
![License](https://img.shields.io/pypi/l/targeting-platform)
## 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](https://gitlab.com/dsp6802915/targeting_platform/-/tree/main/src/targeting_platform/utils_cache.py#L62)) and for locks `PLATFORM_LOCK_` ([LOCK_KEYS_PREFIX](https://gitlab.com/dsp6802915/targeting_platform/-/tree/main/src/targeting_platform/utils_cache.py#L63)).
### 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.
```JSON
{
"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):
```JSON
{
"access_token": "",
"app_scoped_system_user_id":
}
```
#### The Trade Desk (ttd)
Example of credentials (login and password is required for automatic token renewal):
```JSON
{
"PartnerId": "",
"token": "",
"Login": "",
"Password": ""
}
```
## Platforms
### DV360
Library works as with normal lineitems as with YouTube through [SDF](https://developers.google.com/display-video/api/structured-data-file/format). 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](https://developers.facebook.com/docs/marketing-apis/rate-limiting/)) - 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](https://partner.thetradedesk.com/v3/portal/api/ref/post-datagroup)). 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](https://gitlab.com/dsp6802915/targeting_platform/-/tree/main/tests/integration).
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).
Raw data
{
"_id": null,
"home_page": null,
"name": "targeting-platform",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": "Siarhei Ivanou <sinusu@gmail.com>",
"keywords": "dsp, google dv360, meta marketing api, the trade desk",
"author": null,
"author_email": "Siarhei Ivanou <sinusu@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/09/ac/cbc744a4d5c0234b123f5bc3b9fa28f4bc8457864ee0aa1d3b57cec8bc6d/targeting_platform-0.3.4.tar.gz",
"platform": null,
"description": "# Targeting Platform\n\n![Pypi Version](https://img.shields.io/pypi/v/targeting-platform)\n![Python Version](https://img.shields.io/pypi/pyversions/targeting-platform)\n![License](https://img.shields.io/pypi/l/targeting-platform)\n\n## Prerequsites\n\nTo use module following tools need to be configured:\n\n- **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](https://gitlab.com/dsp6802915/targeting_platform/-/tree/main/src/targeting_platform/utils_cache.py#L62)) and for locks `PLATFORM_LOCK_` ([LOCK_KEYS_PREFIX](https://gitlab.com/dsp6802915/targeting_platform/-/tree/main/src/targeting_platform/utils_cache.py#L63)).\n\n### Credentials for platforms\n\nEach platform has it's own format of credentials. You need to obtaint credetantial before starting to use platforms thorugh this module.\n\n#### DV360 (dv360)\n\nRequires service account private key (whole JSON for service account). E.g.\n\n```JSON\n{\n \"type\": \"service_account\",\n \"project_id\": \"\",\n \"private_key_id\": \"\",\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\n\\n-----END PRIVATE KEY-----\\n\",\n \"client_email\": \"\",\n \"client_id\": \"\",\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://oauth2.googleapis.com/token\",\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n \"client_x509_cert_url\": \"\"\n}\n```\n\n#### Meta (Facebook) (meta)\n\nExample of credentails (`app_scoped_system_user_id` is required for detailed access validation):\n\n```JSON\n{\n \"access_token\": \"\",\n \"app_scoped_system_user_id\":\n}\n```\n\n#### The Trade Desk (ttd)\n\nExample of credentials (login and password is required for automatic token renewal):\n\n```JSON\n{\n \"PartnerId\": \"\",\n \"token\": \"\",\n \"Login\": \"\",\n \"Password\": \"\"\n}\n```\n\n## Platforms\n\n### DV360\n\nLibrary works as with normal lineitems as with YouTube through [SDF](https://developers.google.com/display-video/api/structured-data-file/format). 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.\n\n### Meta\n\nWhile testing/using you can receive Rate Limit (set by [Meta Marketing API](https://developers.facebook.com/docs/marketing-apis/rate-limiting/)) - 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).\n\n### The Trade Desk (TTD)\n\nSetting 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](https://partner.thetradedesk.com/v3/portal/api/ref/post-datagroup)). 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.\n\n## How to use\n\nSee examples in [integration tests](https://gitlab.com/dsp6802915/targeting_platform/-/tree/main/tests/integration).\n\nYou can adopt these tests by placing appropriate sectet files into folder `secrets`.\n\n## Locks\n\nTo 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).\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "Set targeting in diffrent advertisment platforms.",
"version": "0.3.4",
"project_urls": {
"Documentation": "https://targeting-platform-dsp6802915-32831787e4a994dfa12bcd1ddb4f2c051.gitlab.io/",
"Homepage": "https://gitlab.com/dsp6802915/targeting_platform"
},
"split_keywords": [
"dsp",
" google dv360",
" meta marketing api",
" the trade desk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ae3e3cd41dee5e4d3a10711f08cecacdda7ff29b46d9314d86c7b01642fa58dc",
"md5": "a41d210612235a8c2565964ef7a2733e",
"sha256": "ef8313a51ba88cdda46a7a39a8240f6d97603103bf362cd17cebfc4a02430cbf"
},
"downloads": -1,
"filename": "targeting_platform-0.3.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a41d210612235a8c2565964ef7a2733e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 46730,
"upload_time": "2024-07-21T16:18:54",
"upload_time_iso_8601": "2024-07-21T16:18:54.908511Z",
"url": "https://files.pythonhosted.org/packages/ae/3e/3cd41dee5e4d3a10711f08cecacdda7ff29b46d9314d86c7b01642fa58dc/targeting_platform-0.3.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "09accbc744a4d5c0234b123f5bc3b9fa28f4bc8457864ee0aa1d3b57cec8bc6d",
"md5": "0057131efa5a01fb20acebc98a59651d",
"sha256": "ca8c4e9f0ec4860d3a11b6eaa12c0b6adb97be9ed383b566a772d292b2996ecd"
},
"downloads": -1,
"filename": "targeting_platform-0.3.4.tar.gz",
"has_sig": false,
"md5_digest": "0057131efa5a01fb20acebc98a59651d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 45446,
"upload_time": "2024-07-21T16:18:56",
"upload_time_iso_8601": "2024-07-21T16:18:56.463525Z",
"url": "https://files.pythonhosted.org/packages/09/ac/cbc744a4d5c0234b123f5bc3b9fa28f4bc8457864ee0aa1d3b57cec8bc6d/targeting_platform-0.3.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-21 16:18:56",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "dsp6802915",
"gitlab_project": "targeting_platform",
"lcname": "targeting-platform"
}