-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from take-kun/release/0.1.1
release: Release 0.1.1
- Loading branch information
Showing
55 changed files
with
103,192 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
47665dc3f4df6a6f81fd32dcf323ed86e3ab7b18 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Reusable build workflow | ||
description: Use prepended with actions/checkout@v3 action to achieve built project package in dist directory | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install poetry | ||
shell: bash | ||
run: pipx install poetry | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
cache: poetry | ||
- name: Install dependencies | ||
shell: bash | ||
run: poetry install | ||
- name: Build distributions | ||
shell: bash | ||
run: poetry build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: mercapi CI | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
lint: | ||
name: Linting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
cache: pip | ||
cache-dependency-path: '**/poetry.lock' | ||
|
||
- name: Install black | ||
run: pip install black | ||
|
||
- name: Check Linting | ||
run: black --check mercapi/ tests/ | ||
|
||
test: | ||
name: Unit test | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: | ||
- "3.7" | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- name: Setup Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
cache: "poetry" | ||
|
||
- name: Update pip | ||
run: python -m pip install --upgrade pip | ||
|
||
- name: Install dependencies | ||
run: poetry install | ||
|
||
- name: Test with pytest | ||
run: poetry run pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Build and publish docs | ||
|
||
on: | ||
release: | ||
types: | ||
- 'released' | ||
workflow_dispatch: | ||
|
||
|
||
jobs: | ||
build_docs: | ||
name: Build docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install poetry | ||
run: pipx install poetry | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
cache: poetry | ||
|
||
- name: Install dependencies (docs only) | ||
run: poetry install --only docs | ||
|
||
- name: Build docs | ||
run: pdoc mercapi -o ./html | ||
|
||
- name: Publish to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Publish to TestPyPI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'release/**' | ||
|
||
jobs: | ||
publish_test: | ||
|
||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build distributions | ||
uses: ./.github/workflows/build | ||
|
||
- name: Publish to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Publish to PyPI | ||
|
||
on: | ||
release: | ||
types: | ||
- 'released' | ||
|
||
jobs: | ||
publish_test: | ||
|
||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build distributions | ||
uses: ./.github/workflows/build | ||
|
||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,3 +108,6 @@ venv.bak/ | |
|
||
# VSCode | ||
.vscode/ | ||
|
||
# pdoc output | ||
html/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## 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`.* |
Oops, something went wrong.