Skip to content

pavelmaksimov/marilyn-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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

Releases

No releases published

Packages

No packages published

Languages