Skip to main content

A Python client for Skroutz API.

Project description

pyskroutz

A Python client for Skroutz API.

pre-commit.ci status build badge testing badge pypi badge code coverage badge

Installation

pip install pyskroutz

Usage

First of all, you have to initiate an client in order to interact with Skroutz API. Make sure that you have a valid pair of client id and client secret. From now on, client will be the following object.

import pyskroutz
client = pyskroutz.client('<client-id>', '<client-secret>')

The client object will be passed as parameter in order to retrieve data from a resource's endpoint.

Search

results = pyskroutz.search(client)("iphone").execute()
results
SearchResultsList(
    categories=[],
    meta=SearchMeta(
        q=None,
        alternatives=[],
        strong_matches=StrongMatcheItem(
            sku=None,
            manufacturer=ManufacturerItem(
                id=356,
                name="Apple",
                image_url=HttpUrl(
                    "https://a.scdn.gr/ds/manufacturers/356/20160322115406_ae6f9a87.png",
                    scheme="https",
                    host="a.scdn.gr",
                    tld="gr",
                    host_type="domain",
                    path="/ds/manufacturers/356/20160322115406_ae6f9a87.png",
                ),
            ),
        ),
        pagination=PaginationItem(page=1, per=25, total_pages=0, total_results=0),
    ),
)

List Categories

categories = pyskroutz.categories(client).get(per=3).execute()
categories
CategoryList(
    categories=[
        CategoryItem(
            web_uri=HttpUrl(
                "https://skroutz.gr/c/1/statherh-tilefwnia.html",
                scheme="https",
                host="skroutz.gr",
                tld="gr",
                host_type="domain",
                path="/c/1/statherh-tilefwnia.html",
            ),
            id=1,
            name="Σταθερή Τηλεφωνία",
            children_count=5,
            image_url=HttpUrl(
                "https://c.scdn.gr/ds/categories/1/20171113120915_72fa0f63.jpeg",
                scheme="https",
                host="c.scdn.gr",
                tld="gr",
                host_type="domain",
                path="/ds/categories/1/20171113120915_72fa0f63.jpeg",
            ),
            parent_id=2,
            fashion=True,
            layout_mode="tiles",
            code="statherh-tilefwnia",
            path="76,1269,2,1",
            show_specifications=False,
            manufacturer_title="Κατασκευαστές",
        ),
        CategoryItem(
            web_uri=HttpUrl(
                "https://skroutz.gr/c/2/tilefwnia.html",
                scheme="https",
                host="skroutz.gr",
                tld="gr",
                host_type="domain",
                path="/c/2/tilefwnia.html",
            ),
            id=2,
            name="Τηλεφωνία",
            children_count=2,
            image_url=HttpUrl(
                "https://b.scdn.gr/ds/categories/2/20171113120916_9d335c35.jpeg",
                scheme="https",
                host="b.scdn.gr",
                tld="gr",
                host_type="domain",
                path="/ds/categories/2/20171113120916_9d335c35.jpeg",
            ),
            parent_id=1269,
            fashion=True,
            layout_mode="tiles",
            code="tilefwnia",
            path="76,1269,2",
            show_specifications=False,
            manufacturer_title="Κατασκευαστές",
        ),
        CategoryItem(
            web_uri=HttpUrl(
                "https://skroutz.gr/c/5/photografia-video.html",
                scheme="https",
                host="skroutz.gr",
                tld="gr",
                host_type="domain",
                path="/c/5/photografia-video.html",
            ),
            id=5,
            name="Φωτογραφία & Video",
            children_count=4,
            image_url=HttpUrl(
                "https://b.scdn.gr/ds/categories/5/20171113120916_dfd75306.jpeg",
                scheme="https",
                host="b.scdn.gr",
                tld="gr",
                host_type="domain",
                path="/ds/categories/5/20171113120916_dfd75306.jpeg",
            ),
            parent_id=1269,
            fashion=True,
            layout_mode="tiles",
            code="photografia-video",
            path="76,1269,5",
            show_specifications=False,
            manufacturer_title="Κατασκευαστές",
        ),
    ],
    meta=MetaItemBase(
        available_filters=None,
        order_by=None,
        order_by_methods=None,
        pagination=PaginationItem(page=1, per=3, total_pages=1251, total_results=3751),
        personalization=None,
        sku_rating_breakdown=None,
        sku_reviews_aggregation=None,
    ),
)

Retrieve a book

book = pyskroutz.books(client).get(242327).execute()
book
BooksRetrieve(
    book=BookItem(
        web_uri=HttpUrl(
            "https://www.skroutz.gr/books/242327.%CE%9F-%CE%A7%CE%AC%CF%81%CE%B9-%CE%A0%CF%8C%CF%84%CE%B5%CF%81-%CE%BA%CE%B1%CE%B9-%CE%B7-%CF%86%CE%B9%CE%BB%CE%BF%CF%83%CE%BF%CF%86%CE%B9%CE%BA%CE%AE-%CE%BB%CE%AF%CE%B8%CE%BF%CF%82.html",
            scheme="https",
            host="www.skroutz.gr",
            tld="gr",
            host_type="domain",
            path="/books/242327.%CE%9F-%CE%A7%CE%AC%CF%81%CE%B9-%CE%A0%CF%8C%CF%84%CE%B5%CF%81-%CE%BA%CE%B1%CE%B9-%CE%B7-%CF%86%CE%B9%CE%BB%CE%BF%CF%83%CE%BF%CF%86%CE%B9%CE%BA%CE%AE-%CE%BB%CE%AF%CE%B8%CE%BF%CF%82.html",
        ),
        price_max=12.96,
        price_min=6.61,
        reviewable=True,
        reviews_count=15,
        reviewscore=4.93333,
        shop_count=42,
        id=242327,
        name="Ο Χάρι Πότερ και η φιλοσοφική λίθος",
        main_author_id=385,
        main_author="J. K. Rowling",
        images=ImageItemBase(
            alternatives=None,
            main=HttpUrl(
                "https://b.scdn.gr/images/sku_main_images/000242/242327/medium_20200219102603_o_chari_poter_kai_i_filosofiki_lithos.jpeg",
                scheme="https",
                host="b.scdn.gr",
                tld="gr",
                host_type="domain",
                path="/images/sku_main_images/000242/242327/medium_20200219102603_o_chari_poter_kai_i_filosofiki_lithos.jpeg",
            ),
        ),
    )
)

For further usage details navigate to Resources. Almost every endpoint of Skroutz API is supported by this client.

How to contribute

If you wish to contribute, check out the CONTRIBUTING.md guide for further details.

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

pyskroutz-0.2.0.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

pyskroutz-0.2.0-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

Details for the file pyskroutz-0.2.0.tar.gz.

File metadata

  • Download URL: pyskroutz-0.2.0.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.6 Linux/5.19.0-41-generic

File hashes

Hashes for pyskroutz-0.2.0.tar.gz
Algorithm Hash digest
SHA256 eca0c32ef399b199efeb7b70c54d2227a1a6b5b7ea11c595acff8b3c55937a11
MD5 5c83d316d71d31da3af95131891dbc4e
BLAKE2b-256 5fe1eb0c6dcf905ddc062a817a56aba8bb346b10d99c3cdcfac5155d648bae8a

See more details on using hashes here.

File details

Details for the file pyskroutz-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pyskroutz-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.6 Linux/5.19.0-41-generic

File hashes

Hashes for pyskroutz-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65dcb8d1f442096a8197a89024e0af03b56867b761a619dff2ccc6787fce638f
MD5 b19e78d252b7ad53faae4b79cef2d4cd
BLAKE2b-256 08b0469811612b32ca2a20ae52acbe8922809257054ef4c5a8558e2bb373bff9

See more details on using hashes here.

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