Skip to main content

Postal Service Python Library

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

Metadata

Release files for postalservice 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for postalservice 0.2.0
File Size Uploaded Provenance
postalservice-0.2.0.tar.gz 5.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for postalservice 0.2.0
File Interpreter ABI Platform
postalservice-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.1 kB

Release files / postalservice-0.2.0.tar.gz

Download URL postalservice-0.2.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
532103a3313f6093801f2fc479d00193fd555fa78f0752a14644b078ee54bd3a
BLAKE2b-256 checksum
How to use checksums
a63c1fa97c27b4c76697749cd0adfadd2cf475851354eafb665f5c4d3df4b076
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / postalservice-0.2.0-py3-none-any.whl

Download URL postalservice-0.2.0-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8cb4763f862cfbb65183caabd63f84348b50bf7bb53fcd0d2fbd01c19dbf187
BLAKE2b-256 checksum
How to use checksums
2dead062667484eedd45e6ff0e94fb054df7c89252f920a53a737044a4a40077
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Security for postalservice 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page