sklik


Namesklik JSON
Version 0.1.4 PyPI version JSON
download
home_page
SummaryPython Sklik API (unofficial)
upload_time2024-01-20 23:30:34
maintainer
docs_urlNone
authorPeter Pleško
requires_python>=3.10,<4.0
licenseMIT
keywords sklik report
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Sklik API Python Client
This repository contains unofficial Python client for interacting with the Sklik API. It provides a simple and convenient way for Python applications to generate reports from Seznam Sklik advertising platform.
## Installation
The `sklik` package can be installed from PyPI. You can install it either with pip or with poetry.
### Using pip
Run the following command in your terminal:
```
pip install sklik
```
### Using poetry
Firstly, ensure you have Poetry installed. If it's not installed, refer to the official Poetry installation guide for instructions.
When Poetry is installed, you can add the sklik package to your project by running:
```
poetry add sklik
```
## Classes and Functions Available
The library includes several major Classes and Functions:
`SklikApi`: Class used to instantiate a SklikApi object which is used for making all requests to the Sklik API.
`sklik_request()`: A low-level function to perform a direct POST request to the Sklik API. It can be used separately when lower-level manipulation of requests is required.
`Report`: Class for dealing with large data set from Sklik API by automatically paginating through the data.
`create_report()`: Utility function to create a new report based on several parameters like account, service, date, fields, granularity etc.
## Usage Guide
### Creating Instance of SklikApi
To create Instance of SklikApi, provide your Sklik token:
```python
from sklik import SklikApi

token = '<sklik_token>'
SklikApi.init(token)
```
This sets a default api instance accessible via `SklikApi.get_default_api()`
### Generating A Report
To generate a report, use the create_report function:
```python
from sklik import create_report
from sklik.object import Account

account_id = int('<account_id>')
account = Account(account_id)

report = create_report(
    account, 
    service='campaigns',
    fields=['id', 'name', 'status', 'impressions']
)
```
Please replace `'<account_id>'`, `'service'` and `'fields'` with your specific account details.
### Iterating Through Pages of A Report
To fetch and iterate through the pages of a report, use the Report object returned by `create_report()`:
```python
for page in report:
    print(page)
```
This will print each page of the report in sequence. The Report class is iterable, and it handles pagination automatically.
### Using sklik_request for Low-Level API Access
The `sklik_request` function lets you make API requests directly, giving you low-level access to the API. It requires parameters like api_url, service, method, and args. Note, however, that using this function, you'll need to handle responses on your own.
Example usage:
```python
response = sklik_request(API_URL, "my_service", "my_method", "my_args")
```
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "sklik",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "sklik,report",
    "author": "Peter Ple\u0161ko",
    "author_email": "peter.plesko@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/9f/20/2bdcedf05a004502ae5943c7e86c713825d6273ae8e0db65ba7d9b15219c/sklik-0.1.4.tar.gz",
    "platform": null,
    "description": "# Sklik API Python Client\nThis repository contains unofficial Python client for interacting with the Sklik API. It provides a simple and convenient way for Python applications to generate reports from Seznam Sklik advertising platform.\n## Installation\nThe `sklik` package can be installed from PyPI. You can install it either with pip or with poetry.\n### Using pip\nRun the following command in your terminal:\n```\npip install sklik\n```\n### Using poetry\nFirstly, ensure you have Poetry installed. If it's not installed, refer to the official Poetry installation guide for instructions.\nWhen Poetry is installed, you can add the sklik package to your project by running:\n```\npoetry add sklik\n```\n## Classes and Functions Available\nThe library includes several major Classes and Functions:\n`SklikApi`: Class used to instantiate a SklikApi object which is used for making all requests to the Sklik API.\n`sklik_request()`: A low-level function to perform a direct POST request to the Sklik API. It can be used separately when lower-level manipulation of requests is required.\n`Report`: Class for dealing with large data set from Sklik API by automatically paginating through the data.\n`create_report()`: Utility function to create a new report based on several parameters like account, service, date, fields, granularity etc.\n## Usage Guide\n### Creating Instance of SklikApi\nTo create Instance of SklikApi, provide your Sklik token:\n```python\nfrom sklik import SklikApi\n\ntoken = '<sklik_token>'\nSklikApi.init(token)\n```\nThis sets a default api instance accessible via `SklikApi.get_default_api()`\n### Generating A Report\nTo generate a report, use the create_report function:\n```python\nfrom sklik import create_report\nfrom sklik.object import Account\n\naccount_id = int('<account_id>')\naccount = Account(account_id)\n\nreport = create_report(\n    account, \n    service='campaigns',\n    fields=['id', 'name', 'status', 'impressions']\n)\n```\nPlease replace `'<account_id>'`, `'service'` and `'fields'` with your specific account details.\n### Iterating Through Pages of A Report\nTo fetch and iterate through the pages of a report, use the Report object returned by `create_report()`:\n```python\nfor page in report:\n    print(page)\n```\nThis will print each page of the report in sequence. The Report class is iterable, and it handles pagination automatically.\n### Using sklik_request for Low-Level API Access\nThe `sklik_request` function lets you make API requests directly, giving you low-level access to the API. It requires parameters like api_url, service, method, and args. Note, however, that using this function, you'll need to handle responses on your own.\nExample usage:\n```python\nresponse = sklik_request(API_URL, \"my_service\", \"my_method\", \"my_args\")\n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python Sklik API (unofficial)",
    "version": "0.1.4",
    "project_urls": null,
    "split_keywords": [
        "sklik",
        "report"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0253386f967adac9c7f119f8480a83281ef529e409d231e142314401fc292e6a",
                "md5": "bdcb2a888194d403cda07d96c5bb1326",
                "sha256": "598e0fe476eb93878f8b72b7471c53a10826dcf525b756b02425570e2690486c"
            },
            "downloads": -1,
            "filename": "sklik-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bdcb2a888194d403cda07d96c5bb1326",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 7341,
            "upload_time": "2024-01-20T23:30:32",
            "upload_time_iso_8601": "2024-01-20T23:30:32.360001Z",
            "url": "https://files.pythonhosted.org/packages/02/53/386f967adac9c7f119f8480a83281ef529e409d231e142314401fc292e6a/sklik-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9f202bdcedf05a004502ae5943c7e86c713825d6273ae8e0db65ba7d9b15219c",
                "md5": "73cdde43bc778529232e21152d9937a9",
                "sha256": "adecd3ba206fc938cf9b13c600e950671a5651068825d73b0436f47b09656bf2"
            },
            "downloads": -1,
            "filename": "sklik-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "73cdde43bc778529232e21152d9937a9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 5912,
            "upload_time": "2024-01-20T23:30:34",
            "upload_time_iso_8601": "2024-01-20T23:30:34.036147Z",
            "url": "https://files.pythonhosted.org/packages/9f/20/2bdcedf05a004502ae5943c7e86c713825d6273ae8e0db65ba7d9b15219c/sklik-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-20 23:30:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "sklik"
}
        
Elapsed time: 0.16476s