Metadata-Version: 2.1
Name: mercapi
Version: 0.3.0
Summary: Python API for querying and browsing mercari.jp
Home-page: https://github.com/take-kun/mercapi/
License: MIT
Keywords: api,scraping
Author: take-kun
Author-email: 109226194+take-kun@users.noreply.github.com
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: ecdsa (>=0.18.0,<0.19.0)
Requires-Dist: httpx (>=0.23.0,<0.24.0)
Requires-Dist: python-jose[cryptography] (>=3.3.0,<4.0.0)
Project-URL: Repository, https://github.com/take-kun/mercapi/
Description-Content-Type: text/markdown

# mercapi

![PyPI](https://img.shields.io/pypi/v/mercapi)
[![Tests](https://github.com/take-kun/mercapi/actions/workflows/check.yaml/badge.svg?branch=main)](https://github.com/take-kun/mercapi/actions/workflows/check.yaml)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mercapi)

[API Documentation](https://take-kun.github.io/mercapi/)

## What is Mercapi?

Mercapi is a Python wrapper for *mercari.jp* API.
It's capable of producing HTTP requests implementing security mechanisms employed in native *mercari.jp* web app.
Requests and responses are mapped to custom classes with type-hinting and documentation.

## Quickstart

First, install the `mercapi` package using the package manager of your choice.

As an example, we want to run the search query `sharpnel`.

```python
from mercapi import Mercapi


m = Mercapi()
results = await m.search('sharpnel')

print(f'Found {results.meta.num_found} results')
for item in results.items:
    print(f'Name: {item.name}\\nPrice: {item.price}\\n')

```

We can use a single result object to retrieve full details of the listing.
```python
item = results.items[0]
full_item = await item.full_item()

print(full_item.description)
```

Or get it directly using an ID.
```python
item = await m.item('m90925725213')

print(item.description)
```

Refer to `mercapi.mercapi.Mercapi` documentation for all implemented features.

*Examples above are not executable. If you want to try them out, run `python example.py`.*
