Skip to main content

POS Media Data Core Python Client

Lightweight helper package for authenticating against POS Media Data Core and calling its Campaigns API from Python. The library exposes two primary objects:

  • Credentials: exchanges a username/password for a short-lived Bearer token.
  • Client: wraps Data Core endpoints (e.g., list campaigns, fetch campaign installations) using an injected Credentials instance.

Installation

pip install surquest-utils-poscore-client

Quickstart

from surquest.utils.poscore.credentials import Credentials
from surquest.utils.poscore.client import Client
import uuid

# Create token provider
creds = Credentials(
    username="your_username",
    password="your_password",
    # Optional: base_url="https://pos-core.pos-media.eu/gate/api/v1"
)

# Wire the authenticated client
client = Client(credentials=creds)

# 1) List campaigns
campaigns = client.get_campaigns(
    size=50,
    orderby="created desc",
    fetch_all=False # Set to True to auto-paginate through all results
)
for campaign in campaigns:
    print(f"Campaign: {campaign.name} with id: `{campaign.id}`

# 2) Get campaign installations
installations = client.get_campaign_installations(
    campaign_id=12345,
    locations=[], # Optional filters
    cm_carriers=[],
    components=[],
    task_types=[]
)
print(installations)

# 3) Fetch a document
doc_id = uuid.UUID("dc85d712-dc49-4e07-bb6c-876a6aa97ec6")
blob = client.fetch_document(document_id=doc_id, thumbnail=False)
print(f"Downloaded {blob.file_name} ({blob.content_type})")

# 4) Export all photos
blob = client.export_photos(
    campaign_id=12345
)

Concepts

  • Token handling: Credentials handles authentication and attaches the Bearer token to each request. Refresh logic is encapsulated so callers do not manually manage tokens.
  • Thin HTTP wrapper: Client keeps endpoints small and explicit; it accepts request parameters and returns parsed JSON (or content for documents).

Common Usage Patterns

  • Pagination: get_campaigns supports fetch_all=True to automatically retrieve all pages. If fetch_all=False, use page and size to paginate manually.
  • Filtering: get_campaign_installations allows filtering by locations, carriers, components, and task types.
  • Document Retrieval: fetch_document retrieves the binary content of a document along with its filename and content type.

Error Handling

  • Authentication errors: raised when credentials are invalid or tokens expire unexpectedly.
  • HTTP errors: surfaced with status codes and response bodies to aid debugging; wrap calls in try/except as needed.

Development

Development of this package is realized via Dev Containers. This ensures a consistent environment for all developers.

  1. Open the project in VS Code.
  2. When prompted, click Reopen in Container (or run the command Dev Containers: Reopen in Container).
  3. The environment will be automatically configured with all dependencies.
  4. Run tests using:
    pytest
    

Support

In case you have any questions or suggestions please contact us: info@surquest.com

Metadata

Release files for surquest-utils-poscore-client 0.0.5

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

Source distribution (sdist)

Source distribution for surquest-utils-poscore-client 0.0.5
File Size Uploaded Provenance Actions
surquest_utils_poscore_client-0.0.5.tar.gz 15.6 kB Without provenance Details for surquest_utils_poscore_client-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for surquest-utils-poscore-client 0.0.5
File Interpreter ABI Platform Actions
surquest_utils_poscore_client-0.0.5-py3-none-any.whl Python 3 none any Details for surquest_utils_poscore_client-0.0.5-py3-none-any.whl

Total release size: 33.6 kB

Release files / surquest_utils_poscore_client-0.0.5.tar.gz

Download URL surquest_utils_poscore_client-0.0.5.tar.gz
Size 15.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0e9fc670312e3f0a7878a3a719758df8c27bb19da9843fa4b42e6cdf02963a73
BLAKE2b-256 checksum
How to use checksums
9047179fc005d07811abb636137c0616e692fb827cb0553c7df6fccfdf722d51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / surquest_utils_poscore_client-0.0.5-py3-none-any.whl

Download URL surquest_utils_poscore_client-0.0.5-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97cfc3c69a6e3e12d13c773f5fd267c46188069c2c4c9011da8183064b5a8c7e
BLAKE2b-256 checksum
How to use checksums
df3e0d545bfb5c1c8fd78cbc5428b8a3f7f0bcbf9e383937f6abf1d37723e7ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for surquest-utils-poscore-client 0.0.5

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.

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files No provenance

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