Skip to main content

Python Sklik API (unofficial)

Project description

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

Using uv

Firstly, ensure you have uv installed. If it's not installed, refer to the official uv installation guide for instructions. When uv is installed, you can add the sklik package to your project by running:

uv 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:

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:

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():

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:

response = sklik_request(API_URL, "my_service", "my_method", "my_args")

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

sklik-1.0.0.tar.gz (47.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sklik-1.0.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file sklik-1.0.0.tar.gz.

File metadata

  • Download URL: sklik-1.0.0.tar.gz
  • Upload date:
  • Size: 47.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for sklik-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e9bb415dd8761fae9d9c4234944cad02f16d90234ea595734ce5576ac8a0a1c3
MD5 655a5c6aee8a317ae8966cd99f954a84
BLAKE2b-256 5aa217f4ecfa619485da0caab726b1ccf5b7f14c6c71f1e945a2c75a383954d7

See more details on using hashes here.

File details

Details for the file sklik-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sklik-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for sklik-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3d865da2d7795b9e51c4579ef3572bf95c5e5ea3bfc829ed82371a5f6ef8f53
MD5 efb1d47e96c2c692256a25bc3ca99d12
BLAKE2b-256 49d79304f72edb9863c0277007c4a79fd5fcc9953049a46ccc83c9093d0ed9a5

See more details on using hashes here.

Supported by

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