Skip to main content

A package for second hand shopping

Project description

Postal Service Python Library

Mercari Fril YJP PyPI version

Python library for scraping second hand Japanese websites for easier access to the search results. Useful for creating datasets, notification systems, or web APIs. Targets the website API if available, or parses the HTML response.

Features

  • Mercari, Fril scraping
  • Filter by keyword and size
  • Built in asynchronous requests for fast html scraping
  • Unit tested locally and with Github Actions workflow

Installation

postalservice is available on PyPI as postalservice

pip install postalservice

One shot example

from postalservice import MercariService

mercari = MercariService()

# The `get_search_results` method returns a `SearchResults` object
searchresults = mercari.get_search_results({'keyword':'comme des garcons', 'size':'XL'})

# When you print the `SearchResults` object, it outputs a well-formatted JSON string
print(searchresults)

Output:

[
    {
        "id": "m65906652855",
        "title": "ルイスレザー ジュンヤワタナベ JUNYA WATANABE MAN ライダース",
        "price": 120000.0,
        "size": "L",
        "url": "https://jp.mercari.com/item/m65906652855",
        "img": [
            "https://static.mercdn.net/c!/w=240,f=webp/thumb/photos/m65906652855_1.jpg?1705291813"
        ]
    },
    # ... more items
]

Main methods of all service classes

BaseService is an abstract base class that defines the interface for a service. All services implement this and therefore have all these class methods:

  • get_search_results(params: dict) -> SearchResults: Fetches data synchronously using the provided parameters, parses the response, and returns the results as SearchResults object.

  • get_search_results_async(params: dict) -> SearchResults: Fetches data asynchronously using the provided parameters, parses the response (asynchronously, if needed), and returns the results as SearchResults object.

todo

  • Rakuten support
  • General improvements to structure of the library
  • Support for multiple sizes for sites where only one size is possible to select at a time

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

postalservice-0.1.5.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

postalservice-0.1.5-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file postalservice-0.1.5.tar.gz.

File metadata

  • Download URL: postalservice-0.1.5.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for postalservice-0.1.5.tar.gz
Algorithm Hash digest
SHA256 d3cad7fa160a926686325ce4b74bb4ab5117ff2dae9f612b6a24e3ab76641dd7
MD5 158471c8b55ad48d53493d36983bd1e3
BLAKE2b-256 db68b0da05bc9e935a6cb77b801aa8e638a4a66fa905d9d56210324d948cbaad

See more details on using hashes here.

File details

Details for the file postalservice-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for postalservice-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 031ae20c5df7f4c68723ab2d14662a3583567739c387c35cf96b8f247e692e6b
MD5 eb9c80b74148c132f5c54449e3e2c3cb
BLAKE2b-256 8506df4a23d5f45af2b018465354a8c9277fffc6eaa573fada859c675c90a3a2

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