Skip to main content

mercari api-like wrapper

Project description

Mercari Wrapper

A simple api wrapper around the Mercari jp site.

Simple usage can be something like

import mercari

for item in mercari.search("東方 ふもふも"):
    print("{}, {}".format(item.productName, item.productURL))

The search call will take a long time because it goes through all the pages to find every item. It does not return parts where you paginate yourself.

the item object contains the following properties:

  • id
  • productURL
  • imageURL
  • productName
  • price
  • status
  • soldOut

If you want to do more specific searching, you can use something like the following

from mercari import search, MercariSearchStatus, MercariSort, MercariOrder

for item in search(
        "",
        sort=MercariSort.SORT_PRICE,
        order=MercariOrder.ORDER_DESC,
        status=MercariSearchStatus.SOLD_OUT
    ):
    print("{}, {}".format(item.productName, item.productURL))

The defaults are currently:

  • sort=MercariSort.SORT_CREATED_TIME
  • order=MercariOrder.ORDER_DESC
  • status=MercariSearchStatus.ON_SALE

Which will sort by most recent to oldest, and only show on sale item.

MercariSort

  • STATUS_DEFAULT
  • STATUS_ON_SALE
  • STATUS_SOLD_OUT

MercariOrder

  • SORT_DEFAULT
  • SORT_CREATED_TIME
  • SORT_NUM_LIKES
  • SORT_SCORE
  • SORT_PRICE

MercariSearchStatus

  • ORDER_DESC
  • ORDER_ASC

You can also pass excluded_keywords="something to exclude" if you want to remove certain pieces from your search

Development

Clone this repo, install the dependencies in requirement.txt and off you go.

Deploying / Publishing

  • python setup.py sdist

  • twine upload dist/mercari-<version>.tar.gz

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

mercari-2.0.1.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file mercari-2.0.1.tar.gz.

File metadata

  • Download URL: mercari-2.0.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.10

File hashes

Hashes for mercari-2.0.1.tar.gz
Algorithm Hash digest
SHA256 6626088400c5a8fb046481f08356d049748451be2c4f56bf1ec23e64900509c3
MD5 7115d0f6badcd3078fa7e88c1ddde4b5
BLAKE2b-256 0e5950fbb435aa6d4dc49b5d7a67d7ee478792f7848f3ed7f51dcdc51841acae

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