compsapi 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {compsapi-0.1.0/src/compsapi.egg-info → compsapi-0.2.0}/PKG-INFO +59 -2
- {compsapi-0.1.0 → compsapi-0.2.0}/README.md +58 -1
- {compsapi-0.1.0 → compsapi-0.2.0}/pyproject.toml +1 -1
- {compsapi-0.1.0 → compsapi-0.2.0}/src/compsapi/_client.py +234 -5
- {compsapi-0.1.0 → compsapi-0.2.0}/src/compsapi/_errors.py +1 -1
- compsapi-0.2.0/src/compsapi/_version.py +1 -0
- compsapi-0.2.0/src/compsapi/types.py +1057 -0
- {compsapi-0.1.0 → compsapi-0.2.0/src/compsapi.egg-info}/PKG-INFO +59 -2
- compsapi-0.2.0/tests/test_unit.py +378 -0
- compsapi-0.1.0/src/compsapi/_version.py +0 -1
- compsapi-0.1.0/src/compsapi/types.py +0 -335
- compsapi-0.1.0/tests/test_unit.py +0 -241
- {compsapi-0.1.0 → compsapi-0.2.0}/LICENSE +0 -0
- {compsapi-0.1.0 → compsapi-0.2.0}/setup.cfg +0 -0
- {compsapi-0.1.0 → compsapi-0.2.0}/src/compsapi/__init__.py +0 -0
- {compsapi-0.1.0 → compsapi-0.2.0}/src/compsapi/py.typed +0 -0
- {compsapi-0.1.0 → compsapi-0.2.0}/src/compsapi.egg-info/SOURCES.txt +0 -0
- {compsapi-0.1.0 → compsapi-0.2.0}/src/compsapi.egg-info/dependency_links.txt +0 -0
- {compsapi-0.1.0 → compsapi-0.2.0}/src/compsapi.egg-info/requires.txt +0 -0
- {compsapi-0.1.0 → compsapi-0.2.0}/src/compsapi.egg-info/top_level.txt +0 -0
- {compsapi-0.1.0 → compsapi-0.2.0}/tests/test_live.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: compsapi
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: eBay sold listings API client for Python: real sold prices, comps and live listings as JSON or pandas, with 3 years of history and 12 more marketplaces.
|
|
5
5
|
Author: CompsAPI
|
|
6
6
|
License-Expression: MIT
|
|
@@ -125,8 +125,60 @@ print(live["total_active"], "listed now")
|
|
|
125
125
|
|
|
126
126
|
for listing in client.iter_active("air jordan 1 chicago", source="poshmark", max_pages=2):
|
|
127
127
|
print(listing["price"], listing["url"])
|
|
128
|
+
|
|
129
|
+
uk = client.active("charizard psa 10", site="UK", sort="ending_soonest", format="auction") # eBay UK, prices in GBP on most listings
|
|
130
|
+
print(uk["currency"], uk["items"][0]["price"], uk["items"][0].get("price_usd"))
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Live listings cover eBay US, UK, Germany, France, Italy, Spain, Canada and Australia. Without `site` you get eBay US. On another site `price` is in the site's own currency on most listings, and `price_usd` is the same price in US dollars.
|
|
134
|
+
|
|
135
|
+
## eBay market data
|
|
136
|
+
|
|
137
|
+
Demand on any listing, sell through, a seller's listings, what is trending and price guidance, from the same key:
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
d = client.demand(["186543210987", "204987654321"], variants=True) # up to 200 item ids
|
|
141
|
+
for item in d["items"]:
|
|
142
|
+
print(item["item_id"], item["in_carts"], item["watchers"], item["sold_24h"], item["total_sold"])
|
|
143
|
+
|
|
144
|
+
t = client.trends("lego 75192", days=90)
|
|
145
|
+
print(t["sell_through_pct"], t["total_sold"], t["daily"][-1])
|
|
146
|
+
|
|
147
|
+
s = client.seller("SELLER_USERNAME", type="sold", size=50) # type="active" for listings for sale now
|
|
148
|
+
client.trending(site="us")["themes"]
|
|
149
|
+
g = client.pricing_guidance("apple iphone 13 128gb unlocked", condition="used")
|
|
150
|
+
print(g["has_guidance"], g["suggested_price"], g["sold_price_min"], g["sold_price_max"])
|
|
151
|
+
|
|
152
|
+
live = client.active("merino base layer", demand=True, variants=True) # the same figures on every row
|
|
153
|
+
print(live["items"][0]["demand"], live["demand_info"])
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
A figure eBay does not report is `None`, never 0. `demand` and `variants` on a row are `None` when nothing is known for that listing. A `400` or `404` from these endpoints carries a short code in `e.message` and a sentence in `e.body["detail"]`. A `503` means the data is not available just now and comes with `Retry-After: 60`, which the client honours before it retries; pass `max_retries=0` to get the error at once.
|
|
157
|
+
|
|
158
|
+
## Promoted listings, watcher history and fee estimates
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
p = client.promoted(item_id="146631061476") # is it promoted, and eBay's suggested ad rate
|
|
162
|
+
print(p["promoted"], p["suggested_ad_rate"])
|
|
163
|
+
client.promoted(ids=["146631061476", "136914165912"]) # the flag for up to 200 listings
|
|
164
|
+
s = client.promoted("lego 75192", sample=20) # how much of a search is promoted
|
|
165
|
+
print(s["listing_count"], s["promoted_pct"], s["suggested_ad_rate"])
|
|
166
|
+
|
|
167
|
+
w = client.watchers("366682689997") # watcher history
|
|
168
|
+
print(w["watchers"], w["new_watchers_7d"], w["new_watchers_30d"], w["trend"])
|
|
169
|
+
|
|
170
|
+
f = client.fees("apple iphone 15 pro max", price=200, shipping=10, ad_rate=5)
|
|
171
|
+
print(f["fees_estimated"]["total"], f["net_estimated"], f["not_included"])
|
|
172
|
+
|
|
173
|
+
i = client.seller("SELLER_USERNAME", insights=True) # seller insights, from the seller's public listings
|
|
174
|
+
print(i["sold"]["listings"], i["sold"]["listings_prev"], i["sold"]["trend"], i["categories"][:3])
|
|
175
|
+
|
|
176
|
+
sold = client.sold("apple iphone 15 pro max", fees=True) # a fee estimate on every row
|
|
177
|
+
live = client.active("lego 75192", promoted=True) # the promoted flag on every row
|
|
128
178
|
```
|
|
129
179
|
|
|
180
|
+
`fees` and the `fees_estimated` row block are estimates for a standard seller, from eBay's published fee schedule (`us`, `gb`, `de`, `ca`, `fr` and `it`). They are not what any seller paid, and `not_included` lists what is left out. `watchers` is watcher history: it has no views and no impressions. `promoted` is `None` when the listing is not live or the flag could not be read. Seller insights are worked out from the seller's public listings: they have no views, impressions, click rates or fees.
|
|
181
|
+
|
|
130
182
|
## Other marketplaces
|
|
131
183
|
|
|
132
184
|
Pass `source=` to read StockX, GOAT, TCGplayer, Reverb, Grailed, Poshmark, Mercari, Vinted, Goldin, Fanatics Collect, MySlabs, Pristine, PSA auction prices, or `all`:
|
|
@@ -200,8 +252,13 @@ Every endpoint parameter in the [reference](https://compsapi.com/docs) is a keyw
|
|
|
200
252
|
## Links
|
|
201
253
|
|
|
202
254
|
- API reference: https://compsapi.com/docs
|
|
203
|
-
- OpenAPI 1.
|
|
255
|
+
- OpenAPI 1.16.0: https://api.compsapi.com/openapi.json
|
|
204
256
|
- Node client: `npm install compsapi`
|
|
205
257
|
- MCP server for AI agents: https://compsapi.com/docs#mcp
|
|
206
258
|
|
|
207
259
|
MIT licensed.
|
|
260
|
+
|
|
261
|
+
## Changes in 0.2.0
|
|
262
|
+
|
|
263
|
+
- Live listings on every eBay site (`site`): sorts `most_watched`, `most_sold` and `most_viewed`, and the filters `authenticity`, `top_rated`, `best_offer_only` and `min_sold`.
|
|
264
|
+
- `units_sold`, `total_sales` and `bids` can be null on some listings.
|
|
@@ -92,8 +92,60 @@ print(live["total_active"], "listed now")
|
|
|
92
92
|
|
|
93
93
|
for listing in client.iter_active("air jordan 1 chicago", source="poshmark", max_pages=2):
|
|
94
94
|
print(listing["price"], listing["url"])
|
|
95
|
+
|
|
96
|
+
uk = client.active("charizard psa 10", site="UK", sort="ending_soonest", format="auction") # eBay UK, prices in GBP on most listings
|
|
97
|
+
print(uk["currency"], uk["items"][0]["price"], uk["items"][0].get("price_usd"))
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Live listings cover eBay US, UK, Germany, France, Italy, Spain, Canada and Australia. Without `site` you get eBay US. On another site `price` is in the site's own currency on most listings, and `price_usd` is the same price in US dollars.
|
|
101
|
+
|
|
102
|
+
## eBay market data
|
|
103
|
+
|
|
104
|
+
Demand on any listing, sell through, a seller's listings, what is trending and price guidance, from the same key:
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
d = client.demand(["186543210987", "204987654321"], variants=True) # up to 200 item ids
|
|
108
|
+
for item in d["items"]:
|
|
109
|
+
print(item["item_id"], item["in_carts"], item["watchers"], item["sold_24h"], item["total_sold"])
|
|
110
|
+
|
|
111
|
+
t = client.trends("lego 75192", days=90)
|
|
112
|
+
print(t["sell_through_pct"], t["total_sold"], t["daily"][-1])
|
|
113
|
+
|
|
114
|
+
s = client.seller("SELLER_USERNAME", type="sold", size=50) # type="active" for listings for sale now
|
|
115
|
+
client.trending(site="us")["themes"]
|
|
116
|
+
g = client.pricing_guidance("apple iphone 13 128gb unlocked", condition="used")
|
|
117
|
+
print(g["has_guidance"], g["suggested_price"], g["sold_price_min"], g["sold_price_max"])
|
|
118
|
+
|
|
119
|
+
live = client.active("merino base layer", demand=True, variants=True) # the same figures on every row
|
|
120
|
+
print(live["items"][0]["demand"], live["demand_info"])
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
A figure eBay does not report is `None`, never 0. `demand` and `variants` on a row are `None` when nothing is known for that listing. A `400` or `404` from these endpoints carries a short code in `e.message` and a sentence in `e.body["detail"]`. A `503` means the data is not available just now and comes with `Retry-After: 60`, which the client honours before it retries; pass `max_retries=0` to get the error at once.
|
|
124
|
+
|
|
125
|
+
## Promoted listings, watcher history and fee estimates
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
p = client.promoted(item_id="146631061476") # is it promoted, and eBay's suggested ad rate
|
|
129
|
+
print(p["promoted"], p["suggested_ad_rate"])
|
|
130
|
+
client.promoted(ids=["146631061476", "136914165912"]) # the flag for up to 200 listings
|
|
131
|
+
s = client.promoted("lego 75192", sample=20) # how much of a search is promoted
|
|
132
|
+
print(s["listing_count"], s["promoted_pct"], s["suggested_ad_rate"])
|
|
133
|
+
|
|
134
|
+
w = client.watchers("366682689997") # watcher history
|
|
135
|
+
print(w["watchers"], w["new_watchers_7d"], w["new_watchers_30d"], w["trend"])
|
|
136
|
+
|
|
137
|
+
f = client.fees("apple iphone 15 pro max", price=200, shipping=10, ad_rate=5)
|
|
138
|
+
print(f["fees_estimated"]["total"], f["net_estimated"], f["not_included"])
|
|
139
|
+
|
|
140
|
+
i = client.seller("SELLER_USERNAME", insights=True) # seller insights, from the seller's public listings
|
|
141
|
+
print(i["sold"]["listings"], i["sold"]["listings_prev"], i["sold"]["trend"], i["categories"][:3])
|
|
142
|
+
|
|
143
|
+
sold = client.sold("apple iphone 15 pro max", fees=True) # a fee estimate on every row
|
|
144
|
+
live = client.active("lego 75192", promoted=True) # the promoted flag on every row
|
|
95
145
|
```
|
|
96
146
|
|
|
147
|
+
`fees` and the `fees_estimated` row block are estimates for a standard seller, from eBay's published fee schedule (`us`, `gb`, `de`, `ca`, `fr` and `it`). They are not what any seller paid, and `not_included` lists what is left out. `watchers` is watcher history: it has no views and no impressions. `promoted` is `None` when the listing is not live or the flag could not be read. Seller insights are worked out from the seller's public listings: they have no views, impressions, click rates or fees.
|
|
148
|
+
|
|
97
149
|
## Other marketplaces
|
|
98
150
|
|
|
99
151
|
Pass `source=` to read StockX, GOAT, TCGplayer, Reverb, Grailed, Poshmark, Mercari, Vinted, Goldin, Fanatics Collect, MySlabs, Pristine, PSA auction prices, or `all`:
|
|
@@ -167,8 +219,13 @@ Every endpoint parameter in the [reference](https://compsapi.com/docs) is a keyw
|
|
|
167
219
|
## Links
|
|
168
220
|
|
|
169
221
|
- API reference: https://compsapi.com/docs
|
|
170
|
-
- OpenAPI 1.
|
|
222
|
+
- OpenAPI 1.16.0: https://api.compsapi.com/openapi.json
|
|
171
223
|
- Node client: `npm install compsapi`
|
|
172
224
|
- MCP server for AI agents: https://compsapi.com/docs#mcp
|
|
173
225
|
|
|
174
226
|
MIT licensed.
|
|
227
|
+
|
|
228
|
+
## Changes in 0.2.0
|
|
229
|
+
|
|
230
|
+
- Live listings on every eBay site (`site`): sorts `most_watched`, `most_sold` and `most_viewed`, and the filters `authenticity`, `top_rated`, `best_offer_only` and `min_sold`.
|
|
231
|
+
- `units_sold`, `total_sales` and `bids` can be null on some listings.
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "compsapi"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "eBay sold listings API client for Python: real sold prices, comps and live listings as JSON or pandas, with 3 years of history and 12 more marketplaces."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -5,7 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
import datetime as _dt
|
|
6
6
|
import os
|
|
7
7
|
import time
|
|
8
|
-
from typing import Any, Dict, Iterable, Iterator, List, Mapping, Optional, Sequence, Union
|
|
8
|
+
from typing import Any, Dict, Iterable, Iterator, List, Literal, Mapping, Optional, Sequence, Union
|
|
9
9
|
|
|
10
10
|
import requests
|
|
11
11
|
|
|
@@ -18,15 +18,26 @@ from .types import (
|
|
|
18
18
|
ActiveSort,
|
|
19
19
|
BestOffer,
|
|
20
20
|
CertResponse,
|
|
21
|
+
DemandResponse,
|
|
22
|
+
FeesResponse,
|
|
21
23
|
Kids,
|
|
24
|
+
WatchersIdsResponse,
|
|
25
|
+
WatchersResponse,
|
|
22
26
|
LookupResponse,
|
|
27
|
+
MarketSite,
|
|
23
28
|
Match,
|
|
24
29
|
PopulationResponse,
|
|
30
|
+
PricingGuidanceResponse,
|
|
31
|
+
PromotedResponse,
|
|
32
|
+
SellerInsightsResponse,
|
|
33
|
+
SellerResponse,
|
|
25
34
|
Site,
|
|
26
35
|
SoldItem,
|
|
27
36
|
SoldResponse,
|
|
28
37
|
Source,
|
|
29
38
|
SourcesResponse,
|
|
39
|
+
TrendingResponse,
|
|
40
|
+
TrendsResponse,
|
|
30
41
|
UsageResponse,
|
|
31
42
|
)
|
|
32
43
|
|
|
@@ -36,7 +47,7 @@ ENV_KEYS = ("COMPSAPI_API_KEY", "COMPSAPI_KEY")
|
|
|
36
47
|
|
|
37
48
|
# How Python values become query strings. The API takes "1" for switches, "true"/"false" for a few
|
|
38
49
|
# card filters, and comma separated lists everywhere a parameter accepts several values.
|
|
39
|
-
_ONE_SWITCHES = {"cards", "stats", "ai", "native_price"}
|
|
50
|
+
_ONE_SWITCHES = {"cards", "stats", "ai", "native_price", "demand", "variants", "promoted", "fees", "insights"}
|
|
40
51
|
_TRUE_FALSE = {"graded", "first_edition"}
|
|
41
52
|
_RESERVED = {"self", "extra", "q"}
|
|
42
53
|
|
|
@@ -248,6 +259,10 @@ class CompsAPI:
|
|
|
248
259
|
style_id: Optional[str] = None,
|
|
249
260
|
item_size: Optional[StrList] = None,
|
|
250
261
|
kids: Union[Kids, bool, None] = None,
|
|
262
|
+
demand: Optional[bool] = None,
|
|
263
|
+
variants: Optional[bool] = None,
|
|
264
|
+
fees: Optional[bool] = None,
|
|
265
|
+
ad_rate: Optional[float] = None,
|
|
251
266
|
**extra: Any,
|
|
252
267
|
) -> SoldResponse:
|
|
253
268
|
"""GET /v1/sold: sold listings for a search, newest sale first.
|
|
@@ -255,7 +270,11 @@ class CompsAPI:
|
|
|
255
270
|
``q`` is required unless ``product_id`` is given (StockX and GOAT). Lists are sent comma separated
|
|
256
271
|
(``condition=["new", "open_box"]``, ``grade=[9, 10]``). Booleans become the API's own switches
|
|
257
272
|
(``stats=True`` sends ``stats=1``, ``graded=False`` sends ``graded=false``). Any parameter the API
|
|
258
|
-
adds later can be passed as a keyword and is sent as is.
|
|
273
|
+
adds later can be passed as a keyword and is sent as is. ``demand=True`` and ``variants=True`` (eBay
|
|
274
|
+
only) add a ``demand`` object and a ``variants`` list to every row; ``demand_info`` and
|
|
275
|
+
``variants_info`` on the answer say what was read. ``fees=True`` (eBay only) adds ``fees_estimated``
|
|
276
|
+
to every row: an estimate of eBay's fees for a standard seller, from eBay's published fee schedule,
|
|
277
|
+
not what the seller paid. ``ad_rate`` (a percent) adds the estimated ad fee to it.
|
|
259
278
|
"""
|
|
260
279
|
if not q and not product_id:
|
|
261
280
|
raise ValueError("q is required (or product_id for source=stockx / goat)")
|
|
@@ -385,6 +404,7 @@ class CompsAPI:
|
|
|
385
404
|
*,
|
|
386
405
|
source: Optional[Source] = None,
|
|
387
406
|
sort: Optional[ActiveSort] = None,
|
|
407
|
+
site: Optional[Site] = None,
|
|
388
408
|
per_page: Optional[int] = None,
|
|
389
409
|
page: Optional[int] = None,
|
|
390
410
|
min_price: Optional[float] = None,
|
|
@@ -399,9 +419,33 @@ class CompsAPI:
|
|
|
399
419
|
item_size: Optional[StrList] = None,
|
|
400
420
|
kids: Union[Kids, bool, None] = None,
|
|
401
421
|
cursor: Optional[str] = None,
|
|
422
|
+
demand: Optional[bool] = None,
|
|
423
|
+
variants: Optional[bool] = None,
|
|
424
|
+
promoted: Optional[bool] = None,
|
|
425
|
+
fees: Optional[bool] = None,
|
|
426
|
+
ad_rate: Optional[float] = None,
|
|
427
|
+
authenticity: Optional[bool] = None,
|
|
428
|
+
top_rated: Optional[bool] = None,
|
|
429
|
+
best_offer_only: Optional[bool] = None,
|
|
430
|
+
min_sold: Optional[int] = None,
|
|
402
431
|
**extra: Any,
|
|
403
432
|
) -> ActiveResponse:
|
|
404
|
-
"""GET /v1/active: listings for sale right now on eBay US or a marketplace.
|
|
433
|
+
"""GET /v1/active: listings for sale right now on eBay (US by default, or site=) or a marketplace.
|
|
434
|
+
|
|
435
|
+
``site`` is the eBay site to search: ``US`` (default), ``UK``, ``DE``, ``FR``, ``IT``, ``ES``, ``CA``
|
|
436
|
+
or ``AU``. On a site other than US every row also has ``price_usd`` and the answer has ``site``,
|
|
437
|
+
``currency`` and ``usd_rate``.
|
|
438
|
+
|
|
439
|
+
``demand=True`` and ``variants=True`` (eBay only) add a ``demand`` object and a ``variants`` list to
|
|
440
|
+
every row. ``promoted=True`` (eBay only) adds ``promoted`` to every row: whether the seller pays to
|
|
441
|
+
promote the listing right now. ``fees=True`` adds ``fees_estimated``: an estimate of eBay's fees for a
|
|
442
|
+
standard seller, from eBay's published fee schedule; ``ad_rate`` (a percent) adds the estimated ad fee.
|
|
443
|
+
|
|
444
|
+
eBay only: ``authenticity=True`` keeps listings covered by eBay's Authenticity Guarantee, ``top_rated=True``
|
|
445
|
+
keeps listings from Top Rated sellers, ``best_offer_only=True`` keeps listings that accept offers and
|
|
446
|
+
``min_sold`` keeps listings with at least that many units sold. ``sort`` also takes ``most_watched``,
|
|
447
|
+
``most_sold`` and ``most_viewed``.
|
|
448
|
+
"""
|
|
405
449
|
if not q and not product_id:
|
|
406
450
|
raise ValueError("q is required (or product_id for source=stockx / goat)")
|
|
407
451
|
return self._request("/v1/active", _params(locals(), extra)) # type: ignore[return-value]
|
|
@@ -414,7 +458,10 @@ class CompsAPI:
|
|
|
414
458
|
max_items: Optional[int] = None,
|
|
415
459
|
**params: Any,
|
|
416
460
|
) -> Iterator[ActiveItem]:
|
|
417
|
-
"""Yield live listings across pages. Follows ``next_cursor`` where a marketplace gives one.
|
|
461
|
+
"""Yield live listings across pages. Follows ``next_cursor`` where a marketplace gives one.
|
|
462
|
+
|
|
463
|
+
Takes the parameters of ``active()``, ``site`` included (``site="UK"`` walks eBay UK).
|
|
464
|
+
"""
|
|
418
465
|
page = int(params.pop("page", None) or 1)
|
|
419
466
|
cursor = params.pop("cursor", None)
|
|
420
467
|
read = n = 0
|
|
@@ -440,6 +487,188 @@ class CompsAPI:
|
|
|
440
487
|
else:
|
|
441
488
|
return
|
|
442
489
|
|
|
490
|
+
# ------------------------------------------------------------------ eBay market data
|
|
491
|
+
|
|
492
|
+
def demand(
|
|
493
|
+
self,
|
|
494
|
+
ids: Union[str, int, Sequence[Union[str, int]]],
|
|
495
|
+
*,
|
|
496
|
+
variants: Optional[bool] = None,
|
|
497
|
+
**extra: Any,
|
|
498
|
+
) -> DemandResponse:
|
|
499
|
+
"""GET /v1/demand: demand signals for up to 200 eBay listings by item id.
|
|
500
|
+
|
|
501
|
+
Cart count, watchers, views and units sold in the last 24 hours, units sold in all and units available.
|
|
502
|
+
``ids`` is one id or a list. ``variants=True`` adds the per variant breakdown. A figure eBay does not
|
|
503
|
+
report is ``None``, never 0; an id eBay does not know comes back with ``found`` false.
|
|
504
|
+
"""
|
|
505
|
+
if not _encode("ids", ids):
|
|
506
|
+
raise ValueError("ids is required: one eBay item id or a list of them")
|
|
507
|
+
return self._request("/v1/demand", _params({"ids": ids, "variants": variants}, extra)) # type: ignore[return-value]
|
|
508
|
+
|
|
509
|
+
def trends(
|
|
510
|
+
self,
|
|
511
|
+
q: str,
|
|
512
|
+
*,
|
|
513
|
+
days: Optional[int] = None,
|
|
514
|
+
site: Optional[MarketSite] = None,
|
|
515
|
+
category: Optional[NumList] = None,
|
|
516
|
+
condition: Optional[StrList] = None,
|
|
517
|
+
**extra: Any,
|
|
518
|
+
) -> TrendsResponse:
|
|
519
|
+
"""GET /v1/trends: sell through (sold against unsold listings) and a row per day for a search.
|
|
520
|
+
|
|
521
|
+
``days`` 1 to 1095 (default 90). ``daily`` has one row per day with items sold and the average sold
|
|
522
|
+
price; ``sell_through_days`` says which window the sell through counts cover.
|
|
523
|
+
"""
|
|
524
|
+
if not q:
|
|
525
|
+
raise ValueError("q is required")
|
|
526
|
+
values = {"q": q, "days": days, "site": site, "category": category, "condition": condition}
|
|
527
|
+
return self._request("/v1/trends", _params(values, extra)) # type: ignore[return-value]
|
|
528
|
+
|
|
529
|
+
def seller(
|
|
530
|
+
self,
|
|
531
|
+
username: str,
|
|
532
|
+
*,
|
|
533
|
+
type: Optional[Literal["sold", "active"]] = None, # noqa: A002 (the API parameter is called type)
|
|
534
|
+
page: Optional[int] = None,
|
|
535
|
+
size: Optional[int] = None,
|
|
536
|
+
summary: Optional[bool] = None,
|
|
537
|
+
details: Optional[bool] = None,
|
|
538
|
+
q: Optional[str] = None,
|
|
539
|
+
category: Optional[NumList] = None,
|
|
540
|
+
format: Optional[Literal["auction", "fixed_price"]] = None, # noqa: A002
|
|
541
|
+
start: Optional[DateLike] = None,
|
|
542
|
+
end: Optional[DateLike] = None,
|
|
543
|
+
insights: Optional[bool] = None,
|
|
544
|
+
**extra: Any,
|
|
545
|
+
) -> Union[SellerResponse, SellerInsightsResponse]:
|
|
546
|
+
"""GET /v1/seller: one seller's sold listings (default) or live listings, plus profile figures.
|
|
547
|
+
|
|
548
|
+
``type="sold"`` covers about the last 90 days; ``q``, ``category``, ``format``, ``start`` and ``end``
|
|
549
|
+
narrow it. ``price`` on a sold listing is the listing's own price when it ended (``None`` on an
|
|
550
|
+
auction), not the amount a buyer paid: use :meth:`sold` for prices paid. ``type="active"`` returns the
|
|
551
|
+
listings for sale now.
|
|
552
|
+
|
|
553
|
+
``insights=True`` returns seller insights in place of a page of listings (a ``SellerInsightsResponse``):
|
|
554
|
+
sold listings of the last period against the one before, by category, and what is for sale now. It is
|
|
555
|
+
worked out from the seller's public listings and has no views, impressions, click rates or fees. The
|
|
556
|
+
other parameters are not used with it.
|
|
557
|
+
"""
|
|
558
|
+
if not username:
|
|
559
|
+
raise ValueError("username is required")
|
|
560
|
+
values = {"username": username, "type": type, "page": page, "size": size, "summary": summary, "details": details,
|
|
561
|
+
"q": q, "category": category, "format": format, "start": start, "end": end, "insights": insights}
|
|
562
|
+
return self._request("/v1/seller", _params(values, extra)) # type: ignore[return-value]
|
|
563
|
+
|
|
564
|
+
def trending(
|
|
565
|
+
self,
|
|
566
|
+
*,
|
|
567
|
+
site: Optional[MarketSite] = None,
|
|
568
|
+
category: Union[int, str, None] = None,
|
|
569
|
+
**extra: Any,
|
|
570
|
+
) -> TrendingResponse:
|
|
571
|
+
"""GET /v1/trending: what is trending on eBay now, as themes with their categories.
|
|
572
|
+
|
|
573
|
+
Themes exist for ``site="us"`` and ``"gb"``; another site answers with ``available`` false.
|
|
574
|
+
"""
|
|
575
|
+
return self._request("/v1/trending", _params({"site": site, "category": category}, extra)) # type: ignore[return-value]
|
|
576
|
+
|
|
577
|
+
def pricing_guidance(
|
|
578
|
+
self,
|
|
579
|
+
q: Optional[str] = None,
|
|
580
|
+
*,
|
|
581
|
+
item_id: Union[int, str, None] = None,
|
|
582
|
+
condition: Optional[StrList] = None,
|
|
583
|
+
category: Union[int, str, None] = None,
|
|
584
|
+
site: Optional[MarketSite] = None,
|
|
585
|
+
**extra: Any,
|
|
586
|
+
) -> PricingGuidanceResponse:
|
|
587
|
+
"""GET /v1/pricing-guidance: eBay's suggested price for an item, the sold range and the sales behind it.
|
|
588
|
+
|
|
589
|
+
Name the item with ``q`` or with ``item_id``. ``has_guidance`` is false (and the prices ``None``) when
|
|
590
|
+
eBay has no suggestion for it.
|
|
591
|
+
"""
|
|
592
|
+
if not q and item_id is None:
|
|
593
|
+
raise ValueError("pass q or item_id")
|
|
594
|
+
values = {"q": q, "item_id": item_id, "condition": condition, "category": category, "site": site}
|
|
595
|
+
return self._request("/v1/pricing-guidance", _params(values, extra)) # type: ignore[return-value]
|
|
596
|
+
|
|
597
|
+
def promoted(
|
|
598
|
+
self,
|
|
599
|
+
q: Optional[str] = None,
|
|
600
|
+
*,
|
|
601
|
+
item_id: Union[int, str, None] = None,
|
|
602
|
+
ids: Union[str, int, Sequence[Union[str, int]], None] = None,
|
|
603
|
+
ad_rate: Optional[bool] = None,
|
|
604
|
+
category: Union[int, str, None] = None,
|
|
605
|
+
sample: Optional[int] = None,
|
|
606
|
+
site: Optional[MarketSite] = None,
|
|
607
|
+
**extra: Any,
|
|
608
|
+
) -> PromotedResponse:
|
|
609
|
+
"""GET /v1/promoted: promoted listing data for eBay.
|
|
610
|
+
|
|
611
|
+
Pass one of: ``item_id`` (is this listing promoted, and eBay's suggested ad rate for it), ``ids`` (the
|
|
612
|
+
promoted flag for up to 200 listings; ``ad_rate=True`` adds the suggested ad rate, then up to 50 ids),
|
|
613
|
+
or ``q`` (the share of live listings for a search that are promoted, plus the suggested ad rates of a
|
|
614
|
+
sample of the newest listings; ``sample`` is 0 to 50). ``promoted`` is ``None`` when the listing is not
|
|
615
|
+
live or the flag could not be read.
|
|
616
|
+
"""
|
|
617
|
+
ids_sent = ids is not None and _encode("ids", ids)
|
|
618
|
+
if not q and item_id is None and not ids_sent:
|
|
619
|
+
raise ValueError("pass q, item_id or ids")
|
|
620
|
+
values = {"q": q, "item_id": item_id, "ids": ids, "ad_rate": ad_rate or None, "category": category, "sample": sample, "site": site}
|
|
621
|
+
return self._request("/v1/promoted", _params(values, extra)) # type: ignore[return-value]
|
|
622
|
+
|
|
623
|
+
def watchers(
|
|
624
|
+
self,
|
|
625
|
+
item_id: Union[int, str, None] = None,
|
|
626
|
+
*,
|
|
627
|
+
ids: Union[str, int, Sequence[Union[str, int]], None] = None,
|
|
628
|
+
site: Optional[MarketSite] = None,
|
|
629
|
+
**extra: Any,
|
|
630
|
+
) -> Union[WatchersResponse, WatchersIdsResponse]:
|
|
631
|
+
"""GET /v1/watchers: the watcher history of an eBay listing.
|
|
632
|
+
|
|
633
|
+
Watchers now and new watchers in the last 1, 7, 30, 60 and 90 days, with a trend. It has no views and
|
|
634
|
+
no impressions. One listing (``item_id``) or up to 20 (``ids``).
|
|
635
|
+
"""
|
|
636
|
+
ids_sent = ids is not None and _encode("ids", ids)
|
|
637
|
+
if item_id is None and not ids_sent:
|
|
638
|
+
raise ValueError("pass item_id or ids")
|
|
639
|
+
return self._request("/v1/watchers", _params({"item_id": item_id, "ids": ids, "site": site}, extra)) # type: ignore[return-value]
|
|
640
|
+
|
|
641
|
+
def fees(
|
|
642
|
+
self,
|
|
643
|
+
q: Optional[str] = None,
|
|
644
|
+
*,
|
|
645
|
+
price: Optional[float] = None,
|
|
646
|
+
shipping: Optional[float] = None,
|
|
647
|
+
quantity: Optional[int] = None,
|
|
648
|
+
category: Union[int, str, None] = None,
|
|
649
|
+
item_id: Union[int, str, None] = None,
|
|
650
|
+
site: Optional[Literal["us", "gb", "de", "ca", "fr", "it", "uk"]] = None,
|
|
651
|
+
ad_rate: Union[float, Literal["suggested"], None] = None,
|
|
652
|
+
shipping_cost: Optional[float] = None,
|
|
653
|
+
cost: Optional[float] = None,
|
|
654
|
+
seller_type: Optional[Literal["business", "private"]] = None,
|
|
655
|
+
**extra: Any,
|
|
656
|
+
) -> FeesResponse:
|
|
657
|
+
"""GET /v1/fees: an estimate of eBay's fees for one sale, and what is left after them.
|
|
658
|
+
|
|
659
|
+
The estimate is for a standard seller in that category and site (``us``, ``gb``, ``de``, ``ca``, ``fr`` or ``it``), worked out from
|
|
660
|
+
eBay's published fee schedule. It is not what any particular seller paid; ``not_included`` in the answer
|
|
661
|
+
lists what it leaves out. Name the category with ``category``, ``item_id`` or ``q``. ``price`` is needed
|
|
662
|
+
unless ``item_id`` is a live listing. ``ad_rate`` is a percent, or ``"suggested"`` with ``item_id``.
|
|
663
|
+
"""
|
|
664
|
+
if not q and item_id is None and category is None:
|
|
665
|
+
raise ValueError("pass q, item_id or category")
|
|
666
|
+
if price is None and item_id is None:
|
|
667
|
+
raise ValueError("price is required unless item_id is a live listing")
|
|
668
|
+
values = {"q": q, "price": price, "shipping": shipping, "quantity": quantity, "category": category, "item_id": item_id,
|
|
669
|
+
"site": site, "ad_rate": ad_rate, "shipping_cost": shipping_cost, "cost": cost, "seller_type": seller_type}
|
|
670
|
+
return self._request("/v1/fees", _params(values, extra)) # type: ignore[return-value]
|
|
671
|
+
|
|
443
672
|
# ------------------------------------------------------------------ account and service
|
|
444
673
|
|
|
445
674
|
def usage(self) -> UsageResponse:
|
|
@@ -48,7 +48,7 @@ class RateLimitError(CompsAPIError):
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
class QuotaExceededError(RateLimitError):
|
|
51
|
-
"""429 with ``error: quota_reached``: the monthly quota is used up until the UTC month
|
|
51
|
+
"""429 with ``error: quota_reached``: the monthly quota is used up until it starts again (the UTC month, or your billing date on a paid plan of an account opened from 1 December 2026, 21:00 UTC)."""
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
class ServerError(CompsAPIError):
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.0"
|