compsapi 0.1.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/LICENSE +21 -0
- compsapi-0.1.0/PKG-INFO +207 -0
- compsapi-0.1.0/README.md +174 -0
- compsapi-0.1.0/pyproject.toml +51 -0
- compsapi-0.1.0/setup.cfg +4 -0
- compsapi-0.1.0/src/compsapi/__init__.py +38 -0
- compsapi-0.1.0/src/compsapi/_client.py +519 -0
- compsapi-0.1.0/src/compsapi/_errors.py +80 -0
- compsapi-0.1.0/src/compsapi/_version.py +1 -0
- compsapi-0.1.0/src/compsapi/py.typed +0 -0
- compsapi-0.1.0/src/compsapi/types.py +335 -0
- compsapi-0.1.0/src/compsapi.egg-info/PKG-INFO +207 -0
- compsapi-0.1.0/src/compsapi.egg-info/SOURCES.txt +16 -0
- compsapi-0.1.0/src/compsapi.egg-info/dependency_links.txt +1 -0
- compsapi-0.1.0/src/compsapi.egg-info/requires.txt +8 -0
- compsapi-0.1.0/src/compsapi.egg-info/top_level.txt +1 -0
- compsapi-0.1.0/tests/test_live.py +91 -0
- compsapi-0.1.0/tests/test_unit.py +241 -0
compsapi-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CompsAPI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
compsapi-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: compsapi
|
|
3
|
+
Version: 0.1.0
|
|
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
|
+
Author: CompsAPI
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://compsapi.com
|
|
8
|
+
Project-URL: Documentation, https://compsapi.com/docs
|
|
9
|
+
Project-URL: API reference (OpenAPI), https://api.compsapi.com/openapi.json
|
|
10
|
+
Project-URL: Pricing, https://compsapi.com/pricing
|
|
11
|
+
Project-URL: Source, https://github.com/getcompsapi/ebay-sold-listings-api
|
|
12
|
+
Project-URL: Issues, https://github.com/getcompsapi/ebay-sold-listings-api/issues
|
|
13
|
+
Keywords: ebay,ebay api,ebay sold listings,ebay sold listings api,ebay sold api,ebay completed listings,sold prices,price history,comps,findCompletedItems,trading cards,psa,pandas
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
20
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: requests>=2.20
|
|
27
|
+
Provides-Extra: pandas
|
|
28
|
+
Requires-Dist: pandas>=1.3; extra == "pandas"
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: pytest>=7; extra == "test"
|
|
31
|
+
Requires-Dist: pandas>=1.3; extra == "test"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# compsapi: eBay sold listings API client for Python
|
|
35
|
+
|
|
36
|
+
eBay sold listings API client for Python: real sold prices, price stats and live listings as JSON or a pandas DataFrame, with up to 3 years of history, accepted Best Offer prices, and 12 more marketplaces (StockX, GOAT, TCGplayer, Reverb, Mercari, Poshmark and others) on the same key.
|
|
37
|
+
|
|
38
|
+
[Docs](https://compsapi.com/docs) · [OpenAPI](https://api.compsapi.com/openapi.json) · [Pricing](https://compsapi.com/pricing) · [Get a free key](https://compsapi.com)
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install compsapi # requests only
|
|
42
|
+
pip install "compsapi[pandas]" # adds DataFrame output
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The free plan is 100 requests a month with no card. Set your key once:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
export COMPSAPI_API_KEY=sk_live_...
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Quickstart
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from compsapi import CompsAPI
|
|
55
|
+
|
|
56
|
+
client = CompsAPI() # reads COMPSAPI_API_KEY, or CompsAPI("sk_live_...")
|
|
57
|
+
|
|
58
|
+
# Sold listings, newest sale first
|
|
59
|
+
res = client.sold("nintendo switch oled", days=30, condition="used", stats=True)
|
|
60
|
+
print(res["stats"]["median"], "median from", res["stats"]["used_for_stats"], "sales")
|
|
61
|
+
for item in res["items"][:5]:
|
|
62
|
+
print(item["last_sold"], item["price"], item["title"])
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Comps for a card in one call
|
|
66
|
+
|
|
67
|
+
`/v1/comps` returns price stats over every matching sale in the window plus the 10 newest sales, with junk listings (lots, mystery packs, replicas) left out by default.
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
res = client.comps("umbreon vmax 215/203", grader="PSA", grade=10)
|
|
71
|
+
s = res["stats"]
|
|
72
|
+
print(f"PSA 10 median ${s['median']:,.2f} (p25 {s['p25']}, p75 {s['p75']}, n={s['used_for_stats']})")
|
|
73
|
+
|
|
74
|
+
raw = client.comps("umbreon vmax 215/203", graded=False) # the raw card market
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Every sale across pages
|
|
78
|
+
|
|
79
|
+
`iter_sold` walks pages in order until `next_page` is false. Each page is one request, so set `max_pages`.
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
for item in client.iter_sold("omega speedmaster", days=365, max_pages=5):
|
|
83
|
+
print(item["item_id"], item["price"])
|
|
84
|
+
|
|
85
|
+
items = client.sold_all("lego 75192", days=90, max_pages=3)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Pages per search depend on the plan (free 10, Starter 25, Growth and up 200). For deep history a fixed window is faster than a long page walk:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from datetime import date
|
|
92
|
+
|
|
93
|
+
q3 = client.sold_all("rolex submariner 126610", start=date(2025, 7, 1), end=date(2025, 9, 30), max_pages=10)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## pandas
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
df = client.sold_df("canon eos r5", days=90, max_pages=2) # one row per sale
|
|
100
|
+
df.set_index("last_sold").resample("W")["price"].median() # weekly median
|
|
101
|
+
|
|
102
|
+
from compsapi import to_dataframe
|
|
103
|
+
df = to_dataframe(client.sold("umbreon vmax 215/203", grader="PSA", grade=9)) # nested card.* -> card_*
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`last_sold` comes back as a UTC datetime column; nested objects are flattened (`card_grade`, `signals_days_on_market`).
|
|
107
|
+
|
|
108
|
+
## Accepted Best Offer prices
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
res = client.sold("omega speedmaster", days=30, best_offer=True) # adds best_offer to each row
|
|
112
|
+
offers = client.sold("omega speedmaster", days=30, best_offer="only") # accepted offers only
|
|
113
|
+
checked = client.sold("omega speedmaster", days=30, best_offer="verify")
|
|
114
|
+
for i in checked["items"]:
|
|
115
|
+
print(i["price"], i.get("best_offer_confidence"), i.get("asking_price"))
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`price` is what the buyer paid, so an accepted offer shows the offer price, never the asking price.
|
|
119
|
+
|
|
120
|
+
## Live listings
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
live = client.active("kitchenaid mixer", sort="price_asc", condition="used", per_page=50)
|
|
124
|
+
print(live["total_active"], "listed now")
|
|
125
|
+
|
|
126
|
+
for listing in client.iter_active("air jordan 1 chicago", source="poshmark", max_pages=2):
|
|
127
|
+
print(listing["price"], listing["url"])
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Other marketplaces
|
|
131
|
+
|
|
132
|
+
Pass `source=` to read StockX, GOAT, TCGplayer, Reverb, Grailed, Poshmark, Mercari, Vinted, Goldin, Fanatics Collect, MySlabs, Pristine, PSA auction prices, or `all`:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
client.sold("jordan 4 black cat", source="stockx", item_size="10", days=90)
|
|
136
|
+
client.comps("fender stratocaster american professional ii", source="reverb")
|
|
137
|
+
client.sources()["sources"]
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## PSA population and certs
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
spec = client.lookup("2018 panini prizm luka doncic 280")["results"][0]["spec_id"]
|
|
144
|
+
pop = client.population(spec=spec)
|
|
145
|
+
print(pop["total_graded"], pop["gem_rate"])
|
|
146
|
+
cert = client.cert("<PSA cert number>", recent=5) # the number on the slab label
|
|
147
|
+
print(cert["found"], cert.get("grade"))
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Coming from findCompletedItems
|
|
151
|
+
|
|
152
|
+
eBay's Finding API (`findCompletedItems`) is gone. The same request with this client:
|
|
153
|
+
|
|
154
|
+
| findCompletedItems | compsapi |
|
|
155
|
+
|---|---|
|
|
156
|
+
| `keywords` | `q` |
|
|
157
|
+
| `itemFilter SoldItemsOnly=true` | always on: `/v1/sold` returns sales only |
|
|
158
|
+
| `itemFilter Condition` | `condition="new"` (also `open_box`, `refurbished`, `used`, `parts`, comma list) |
|
|
159
|
+
| `itemFilter EndTimeFrom` / `EndTimeTo` | `start` / `end` (YYYY-MM-DD) or `days` |
|
|
160
|
+
| `itemFilter MinPrice` / `MaxPrice` | `min_price` / `max_price` |
|
|
161
|
+
| `categoryId` | `category` |
|
|
162
|
+
| `GLOBAL-ID` (EBAY-GB, EBAY-DE ...) | `site="UK"`, `"DE"`, `"FR"`, `"IT"`, `"ES"`, `"CA"`, `"AU"` |
|
|
163
|
+
| `paginationInput.entriesPerPage` / `pageNumber` | `size` (10 to 240) / `page`, or `iter_sold()` |
|
|
164
|
+
| `sellingStatus.currentPrice` | `price` (USD, what the buyer paid) |
|
|
165
|
+
| `listingInfo.endTime` | `last_sold` |
|
|
166
|
+
| `sellingStatus.bidCount` | `bids` |
|
|
167
|
+
| `galleryURL` / `viewItemURL` | `image` / `url` |
|
|
168
|
+
|
|
169
|
+
## Errors and limits
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
from compsapi import CompsAPIError, QuotaExceededError, RateLimitError
|
|
173
|
+
|
|
174
|
+
try:
|
|
175
|
+
client.sold("charizard")
|
|
176
|
+
except QuotaExceededError:
|
|
177
|
+
... # monthly quota used; resets with the UTC month
|
|
178
|
+
except RateLimitError as e:
|
|
179
|
+
print("retry in", e.retry_after)
|
|
180
|
+
except CompsAPIError as e:
|
|
181
|
+
print(e.status, e.message)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
| Class | When |
|
|
185
|
+
|---|---|
|
|
186
|
+
| `BadRequestError` | 400: missing or invalid parameter, page past the plan limit, search too broad |
|
|
187
|
+
| `AuthenticationError` | 401: missing or wrong key |
|
|
188
|
+
| `PermissionDeniedError` | 403: key expired |
|
|
189
|
+
| `RateLimitError` / `QuotaExceededError` | 429: per minute rate (retried for you, honouring `Retry-After`) / monthly quota |
|
|
190
|
+
| `ServerError` | 5xx (retried for you) |
|
|
191
|
+
|
|
192
|
+
Failed searches do not count against your quota. `client.usage()` is free and shows today's use and your caps; `client.last_rate_limit` holds the rate headers of the last response.
|
|
193
|
+
|
|
194
|
+
## Options
|
|
195
|
+
|
|
196
|
+
`CompsAPI(api_key=None, base_url="https://api.compsapi.com", timeout=90, max_retries=2, session=None, user_agent=None)`
|
|
197
|
+
|
|
198
|
+
Every endpoint parameter in the [reference](https://compsapi.com/docs) is a keyword argument. Lists are sent comma separated (`grade=[9, 10]`), booleans become the API's switches (`stats=True`), dates become `YYYY-MM-DD`. Responses are plain dicts with `TypedDict` hints (`compsapi.types`), so new fields come through untouched.
|
|
199
|
+
|
|
200
|
+
## Links
|
|
201
|
+
|
|
202
|
+
- API reference: https://compsapi.com/docs
|
|
203
|
+
- OpenAPI 1.11.0: https://api.compsapi.com/openapi.json
|
|
204
|
+
- Node client: `npm install compsapi`
|
|
205
|
+
- MCP server for AI agents: https://compsapi.com/docs#mcp
|
|
206
|
+
|
|
207
|
+
MIT licensed.
|
compsapi-0.1.0/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# compsapi: eBay sold listings API client for Python
|
|
2
|
+
|
|
3
|
+
eBay sold listings API client for Python: real sold prices, price stats and live listings as JSON or a pandas DataFrame, with up to 3 years of history, accepted Best Offer prices, and 12 more marketplaces (StockX, GOAT, TCGplayer, Reverb, Mercari, Poshmark and others) on the same key.
|
|
4
|
+
|
|
5
|
+
[Docs](https://compsapi.com/docs) · [OpenAPI](https://api.compsapi.com/openapi.json) · [Pricing](https://compsapi.com/pricing) · [Get a free key](https://compsapi.com)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install compsapi # requests only
|
|
9
|
+
pip install "compsapi[pandas]" # adds DataFrame output
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The free plan is 100 requests a month with no card. Set your key once:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
export COMPSAPI_API_KEY=sk_live_...
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quickstart
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
from compsapi import CompsAPI
|
|
22
|
+
|
|
23
|
+
client = CompsAPI() # reads COMPSAPI_API_KEY, or CompsAPI("sk_live_...")
|
|
24
|
+
|
|
25
|
+
# Sold listings, newest sale first
|
|
26
|
+
res = client.sold("nintendo switch oled", days=30, condition="used", stats=True)
|
|
27
|
+
print(res["stats"]["median"], "median from", res["stats"]["used_for_stats"], "sales")
|
|
28
|
+
for item in res["items"][:5]:
|
|
29
|
+
print(item["last_sold"], item["price"], item["title"])
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Comps for a card in one call
|
|
33
|
+
|
|
34
|
+
`/v1/comps` returns price stats over every matching sale in the window plus the 10 newest sales, with junk listings (lots, mystery packs, replicas) left out by default.
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
res = client.comps("umbreon vmax 215/203", grader="PSA", grade=10)
|
|
38
|
+
s = res["stats"]
|
|
39
|
+
print(f"PSA 10 median ${s['median']:,.2f} (p25 {s['p25']}, p75 {s['p75']}, n={s['used_for_stats']})")
|
|
40
|
+
|
|
41
|
+
raw = client.comps("umbreon vmax 215/203", graded=False) # the raw card market
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Every sale across pages
|
|
45
|
+
|
|
46
|
+
`iter_sold` walks pages in order until `next_page` is false. Each page is one request, so set `max_pages`.
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
for item in client.iter_sold("omega speedmaster", days=365, max_pages=5):
|
|
50
|
+
print(item["item_id"], item["price"])
|
|
51
|
+
|
|
52
|
+
items = client.sold_all("lego 75192", days=90, max_pages=3)
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Pages per search depend on the plan (free 10, Starter 25, Growth and up 200). For deep history a fixed window is faster than a long page walk:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from datetime import date
|
|
59
|
+
|
|
60
|
+
q3 = client.sold_all("rolex submariner 126610", start=date(2025, 7, 1), end=date(2025, 9, 30), max_pages=10)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## pandas
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
df = client.sold_df("canon eos r5", days=90, max_pages=2) # one row per sale
|
|
67
|
+
df.set_index("last_sold").resample("W")["price"].median() # weekly median
|
|
68
|
+
|
|
69
|
+
from compsapi import to_dataframe
|
|
70
|
+
df = to_dataframe(client.sold("umbreon vmax 215/203", grader="PSA", grade=9)) # nested card.* -> card_*
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`last_sold` comes back as a UTC datetime column; nested objects are flattened (`card_grade`, `signals_days_on_market`).
|
|
74
|
+
|
|
75
|
+
## Accepted Best Offer prices
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
res = client.sold("omega speedmaster", days=30, best_offer=True) # adds best_offer to each row
|
|
79
|
+
offers = client.sold("omega speedmaster", days=30, best_offer="only") # accepted offers only
|
|
80
|
+
checked = client.sold("omega speedmaster", days=30, best_offer="verify")
|
|
81
|
+
for i in checked["items"]:
|
|
82
|
+
print(i["price"], i.get("best_offer_confidence"), i.get("asking_price"))
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
`price` is what the buyer paid, so an accepted offer shows the offer price, never the asking price.
|
|
86
|
+
|
|
87
|
+
## Live listings
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
live = client.active("kitchenaid mixer", sort="price_asc", condition="used", per_page=50)
|
|
91
|
+
print(live["total_active"], "listed now")
|
|
92
|
+
|
|
93
|
+
for listing in client.iter_active("air jordan 1 chicago", source="poshmark", max_pages=2):
|
|
94
|
+
print(listing["price"], listing["url"])
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Other marketplaces
|
|
98
|
+
|
|
99
|
+
Pass `source=` to read StockX, GOAT, TCGplayer, Reverb, Grailed, Poshmark, Mercari, Vinted, Goldin, Fanatics Collect, MySlabs, Pristine, PSA auction prices, or `all`:
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
client.sold("jordan 4 black cat", source="stockx", item_size="10", days=90)
|
|
103
|
+
client.comps("fender stratocaster american professional ii", source="reverb")
|
|
104
|
+
client.sources()["sources"]
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## PSA population and certs
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
spec = client.lookup("2018 panini prizm luka doncic 280")["results"][0]["spec_id"]
|
|
111
|
+
pop = client.population(spec=spec)
|
|
112
|
+
print(pop["total_graded"], pop["gem_rate"])
|
|
113
|
+
cert = client.cert("<PSA cert number>", recent=5) # the number on the slab label
|
|
114
|
+
print(cert["found"], cert.get("grade"))
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Coming from findCompletedItems
|
|
118
|
+
|
|
119
|
+
eBay's Finding API (`findCompletedItems`) is gone. The same request with this client:
|
|
120
|
+
|
|
121
|
+
| findCompletedItems | compsapi |
|
|
122
|
+
|---|---|
|
|
123
|
+
| `keywords` | `q` |
|
|
124
|
+
| `itemFilter SoldItemsOnly=true` | always on: `/v1/sold` returns sales only |
|
|
125
|
+
| `itemFilter Condition` | `condition="new"` (also `open_box`, `refurbished`, `used`, `parts`, comma list) |
|
|
126
|
+
| `itemFilter EndTimeFrom` / `EndTimeTo` | `start` / `end` (YYYY-MM-DD) or `days` |
|
|
127
|
+
| `itemFilter MinPrice` / `MaxPrice` | `min_price` / `max_price` |
|
|
128
|
+
| `categoryId` | `category` |
|
|
129
|
+
| `GLOBAL-ID` (EBAY-GB, EBAY-DE ...) | `site="UK"`, `"DE"`, `"FR"`, `"IT"`, `"ES"`, `"CA"`, `"AU"` |
|
|
130
|
+
| `paginationInput.entriesPerPage` / `pageNumber` | `size` (10 to 240) / `page`, or `iter_sold()` |
|
|
131
|
+
| `sellingStatus.currentPrice` | `price` (USD, what the buyer paid) |
|
|
132
|
+
| `listingInfo.endTime` | `last_sold` |
|
|
133
|
+
| `sellingStatus.bidCount` | `bids` |
|
|
134
|
+
| `galleryURL` / `viewItemURL` | `image` / `url` |
|
|
135
|
+
|
|
136
|
+
## Errors and limits
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from compsapi import CompsAPIError, QuotaExceededError, RateLimitError
|
|
140
|
+
|
|
141
|
+
try:
|
|
142
|
+
client.sold("charizard")
|
|
143
|
+
except QuotaExceededError:
|
|
144
|
+
... # monthly quota used; resets with the UTC month
|
|
145
|
+
except RateLimitError as e:
|
|
146
|
+
print("retry in", e.retry_after)
|
|
147
|
+
except CompsAPIError as e:
|
|
148
|
+
print(e.status, e.message)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
| Class | When |
|
|
152
|
+
|---|---|
|
|
153
|
+
| `BadRequestError` | 400: missing or invalid parameter, page past the plan limit, search too broad |
|
|
154
|
+
| `AuthenticationError` | 401: missing or wrong key |
|
|
155
|
+
| `PermissionDeniedError` | 403: key expired |
|
|
156
|
+
| `RateLimitError` / `QuotaExceededError` | 429: per minute rate (retried for you, honouring `Retry-After`) / monthly quota |
|
|
157
|
+
| `ServerError` | 5xx (retried for you) |
|
|
158
|
+
|
|
159
|
+
Failed searches do not count against your quota. `client.usage()` is free and shows today's use and your caps; `client.last_rate_limit` holds the rate headers of the last response.
|
|
160
|
+
|
|
161
|
+
## Options
|
|
162
|
+
|
|
163
|
+
`CompsAPI(api_key=None, base_url="https://api.compsapi.com", timeout=90, max_retries=2, session=None, user_agent=None)`
|
|
164
|
+
|
|
165
|
+
Every endpoint parameter in the [reference](https://compsapi.com/docs) is a keyword argument. Lists are sent comma separated (`grade=[9, 10]`), booleans become the API's switches (`stats=True`), dates become `YYYY-MM-DD`. Responses are plain dicts with `TypedDict` hints (`compsapi.types`), so new fields come through untouched.
|
|
166
|
+
|
|
167
|
+
## Links
|
|
168
|
+
|
|
169
|
+
- API reference: https://compsapi.com/docs
|
|
170
|
+
- OpenAPI 1.11.0: https://api.compsapi.com/openapi.json
|
|
171
|
+
- Node client: `npm install compsapi`
|
|
172
|
+
- MCP server for AI agents: https://compsapi.com/docs#mcp
|
|
173
|
+
|
|
174
|
+
MIT licensed.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "compsapi"
|
|
7
|
+
version = "0.1.0"
|
|
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
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "CompsAPI" }]
|
|
14
|
+
keywords = [
|
|
15
|
+
"ebay", "ebay api", "ebay sold listings", "ebay sold listings api", "ebay sold api", "ebay completed listings",
|
|
16
|
+
"sold prices", "price history", "comps", "findCompletedItems", "trading cards", "psa", "pandas",
|
|
17
|
+
]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 4 - Beta",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
25
|
+
"Topic :: Office/Business :: Financial",
|
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
"Typing :: Typed",
|
|
28
|
+
]
|
|
29
|
+
dependencies = ["requests>=2.20"]
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
pandas = ["pandas>=1.3"]
|
|
33
|
+
test = ["pytest>=7", "pandas>=1.3"]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://compsapi.com"
|
|
37
|
+
Documentation = "https://compsapi.com/docs"
|
|
38
|
+
"API reference (OpenAPI)" = "https://api.compsapi.com/openapi.json"
|
|
39
|
+
Pricing = "https://compsapi.com/pricing"
|
|
40
|
+
Source = "https://github.com/getcompsapi/ebay-sold-listings-api"
|
|
41
|
+
Issues = "https://github.com/getcompsapi/ebay-sold-listings-api/issues"
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.packages.find]
|
|
44
|
+
where = ["src"]
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.package-data]
|
|
47
|
+
compsapi = ["py.typed"]
|
|
48
|
+
|
|
49
|
+
[tool.pytest.ini_options]
|
|
50
|
+
testpaths = ["tests"]
|
|
51
|
+
markers = ["live: calls the real API (needs COMPSAPI_TEST_KEY)"]
|
compsapi-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""eBay sold listings API client for Python: sold prices, comps and live listings from CompsAPI.
|
|
2
|
+
|
|
3
|
+
Docs: https://compsapi.com/docs
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from ._client import DEFAULT_BASE_URL, CompsAPI, RateLimitInfo, to_dataframe
|
|
7
|
+
from ._errors import (
|
|
8
|
+
APIConnectionError,
|
|
9
|
+
AuthenticationError,
|
|
10
|
+
BadRequestError,
|
|
11
|
+
CompsAPIError,
|
|
12
|
+
NotFoundError,
|
|
13
|
+
PermissionDeniedError,
|
|
14
|
+
QuotaExceededError,
|
|
15
|
+
RateLimitError,
|
|
16
|
+
ServerError,
|
|
17
|
+
)
|
|
18
|
+
from ._version import __version__
|
|
19
|
+
|
|
20
|
+
Client = CompsAPI
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"CompsAPI",
|
|
24
|
+
"Client",
|
|
25
|
+
"DEFAULT_BASE_URL",
|
|
26
|
+
"RateLimitInfo",
|
|
27
|
+
"to_dataframe",
|
|
28
|
+
"CompsAPIError",
|
|
29
|
+
"APIConnectionError",
|
|
30
|
+
"AuthenticationError",
|
|
31
|
+
"BadRequestError",
|
|
32
|
+
"NotFoundError",
|
|
33
|
+
"PermissionDeniedError",
|
|
34
|
+
"QuotaExceededError",
|
|
35
|
+
"RateLimitError",
|
|
36
|
+
"ServerError",
|
|
37
|
+
"__version__",
|
|
38
|
+
]
|