Skip to main content

Async client for Marilyn API

Project description

Supported Python Versions GitHub license Downloads Code style: black

Async client for Marilyn API

Installation

pip install marilyn-api

Examples

from marilyn_api import AsyncClient

api_root = "https://app.mymarilyn.ru"
headers = {
    "X-API-Account": 100500,
    "X-API-Token": "{auth token}",
}
aclient = AsyncClient(api_root, headers=headers)

body = {
    "channel_id": [],
    "start_date": "2022-02-01",
    "end_date": "2022-02-18",
    "date_grouping": "day",
    "grouping": "placement",
    "filtering": [
        {
            "entity": "no",
            "entities": []
        },
        {
            "entity": "project",
            "entities": [
                4551
            ]
        }
    ],
    "custom_metrics": [],
    "profiles": [],
    "goals": [],
    "with_vat": False,
    "per_page": 200,
    "sorting": "date",
    "columns": [
        "date",
        "placement_id",
        "placement_name",
        "campaign_xid",
        "channel_id",
        "impressions",
        "clicks",
        "cpm_fact",
        "reach_total_sum",
        "viral_reach_total_sum",
        "ctr",
        "cost_fact",
        "cpc_fact",
        "orders",
        "model_orders",
        "revenue",
        "revenue_model_orders"
    ]
}

async for page in aclient.iter_statistics_detailed(body):
    for item in page["items"]:
        print("RECORD:", item)

Script examples

python Examples/statistics_detailed.py --help
python Examples/statistics_detailed.py -r https://app.mymarilyn.ru -a 100500 -t MytoKeN12345 -c Examples/detailed-stats-config.json
python Examples/project_placements.py.py --help
python Examples/project_placements.py.py -r https://app.mymarilyn.ru -a 100500 -p 12345 -t MytoKeN12345

Dependencies

  • aiohttp

Author

Pavel Maksimov

You can contact me at Telegram

Удачи тебе, друг! Поставь звездочку ;)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marilyn-api-0.1.1.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

marilyn_api-0.1.1-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page