API exposes most important Grailed API endpoints
Project description
Grailed API
This repository provides most important features when it comes to Grailed API. This is only for searching objects, since there is no official API, or API key.
How to install
In order to install the package, just run following command pip install grailed_api
How to install locally
- Install
poetry(https://python-poetry.org/) - Clone repo
git clone https://github.com/pznamir00/Grailed-API - Run
poetry installcommand.
How to use
In order to use the features, just import GrailedAPIClient
from grailed_api import GrailedAPIClient
client = GrailedAPIClient()
Then you are ready to use searching functions
Methods
-
find_products- returns products list-
Parameters:
sold(bool, optional): include sold products. Defaults to True.on_sale(bool, optional): include products on sale. Defaults to True.staff_pick(bool, optional): get only products that have been marked by staff. Defaults to False.department(Departments, optional): department, menswear or womenwear. Defaults to Departments.MENSWEAR.query_search(str, optional): filter by keyword. Defaults to "".page(int, optional): page index. Defaults to 1.hits_per_page(int, optional): products number in one page. Defaults to 40.price_from(int, optional): filter by min price. Defaults to 0.price_to(int, optional): filter by max price. Defaults to 1_000_000.categories(Iterable[Category], optional): filter by categories. Defaults to ().sizes(Iterable[Size], optional): filter by sizes. Defaults to ().designers(Iterable[str], optional): filter by designer names. Defaults to ().conditions(Iterable[Condition], optional): filter by conditions. Defaults to ().markets(Iterable[Markets], optional): filter by markets. Defaults to ().locations(Iterable[Locations], optional): filter by locations. Defaults to ().max_values_per_facet(int, optional): Defaults to 100.facets(Iterable[Facets], optional): Defaults to all facets.verbose(bool, optional): show http request. Defaults to False.
-
Description: For parameters
department,categories,sizes,conditions,markets,locations,facetsuse builtin enums that are available inenums.categoriesmodule. There are following categories:Tops,Bottoms,Outerwear,Footwear,Tailoring,Accessoriesavailable underenums.categoriesmodule.sizesparameter should contain categories' sizes that are accessible in.sizesproperties (e.g.Tops.sizesorOuterwear.sizes). Note if you are gonna include size and won't include it's category, it won't be affected as well as including category with sizes of different categories. You can see the example below -
Example:
from grailed_api.enums import Conditions, Markets, Locations from grailed_api.enums.categories import Tops products = client.find_products( sold=False, query_search='vintage', categories=[Tops.BUTTON_UPS, Tops.JERSEYS], sizes=[Tops.sizes.L, Tops.sizes.M, Tops.sizes.S], price_from=100, price_to=200, conditions=[Conditions.IS_GENTLY_USED, Conditions.IS_NEW], markets=[Markets.BASIC, Markets.GRAILED], locations=[Locations.ASIA, Locations.EUROPE] )
-
-
find_product_by_id- find one product with provided id. If product doesn't exist, an error will be thrown- Parameters:
id(str): product idverbose(bool, optional): show http request. Defaults to False.
- Example:
product = client.find_product_by_id(id='123456789')
- Parameters:
-
find_brands- find brands that match to query search- Parameters:
query(str): keyword to search a brandverbose(bool, optional): show http request. Defaults to False.
- Example:
brands = client.find_brands(query='levis')
- Parameters:
How to test
To test the API, just run poetry run pytest command.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grailed_api-0.1.5.tar.gz.
File metadata
- Download URL: grailed_api-0.1.5.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/22.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2925f65683b83ea3f853e47fa401064b6fc779e6ae2f8542c8769d36157622e6
|
|
| MD5 |
9ec628b4a830fd60dccdac3b1ce3025d
|
|
| BLAKE2b-256 |
6aa6e39c76a40af930e24c3957b01393c1b6ce51bc1646aa9070597fbdfdae47
|
File details
Details for the file grailed_api-0.1.5-py3-none-any.whl.
File metadata
- Download URL: grailed_api-0.1.5-py3-none-any.whl
- Upload date:
- Size: 22.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/22.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2fd6b73a20f4e72a0f40a692b4f7b0fe998b5d9fd6bc77ac7c59e8bd491f493c
|
|
| MD5 |
f284fa61ef817688253db5c9ac1d724e
|
|
| BLAKE2b-256 |
b346758d16762e613f42a03641a2054c83efebc1b10ef4c0a0cb95a44e0a8030
|