vinted-api-kit 0.1.0__tar.gz → 1.0.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.
- {vinted_api_kit-0.1.0 → vinted_api_kit-1.0.0}/.github/workflows/ci.yaml +5 -7
- {vinted_api_kit-0.1.0 → vinted_api_kit-1.0.0}/.github/workflows/coverage.yaml +2 -4
- {vinted_api_kit-0.1.0 → vinted_api_kit-1.0.0}/.gitignore +4 -1
- {vinted_api_kit-0.1.0 → vinted_api_kit-1.0.0}/.pre-commit-config.yaml +6 -0
- vinted_api_kit-1.0.0/CHANGELOG.md +69 -0
- {vinted_api_kit-0.1.0 → vinted_api_kit-1.0.0}/LICENSE +6 -0
- vinted_api_kit-1.0.0/Makefile +91 -0
- vinted_api_kit-1.0.0/PKG-INFO +424 -0
- vinted_api_kit-1.0.0/README.md +392 -0
- vinted_api_kit-1.0.0/examples/base_usage.py +32 -0
- vinted_api_kit-1.0.0/examples/raw_data.py +23 -0
- vinted_api_kit-1.0.0/examples/with_proxy.py +41 -0
- {vinted_api_kit-0.1.0 → vinted_api_kit-1.0.0}/pyproject.toml +30 -15
- vinted_api_kit-1.0.0/tests/api/test_catalog.py +98 -0
- vinted_api_kit-1.0.0/tests/api/test_items.py +64 -0
- vinted_api_kit-1.0.0/tests/conftest.py +74 -0
- vinted_api_kit-1.0.0/tests/models/test_catalog_item.py +54 -0
- vinted_api_kit-1.0.0/tests/models/test_config.py +47 -0
- vinted_api_kit-1.0.0/tests/models/test_detailed_item.py +41 -0
- vinted_api_kit-1.0.0/tests/storage/test_json.py +95 -0
- vinted_api_kit-1.0.0/tests/storage/test_mozilla.py +49 -0
- vinted_api_kit-1.0.0/tests/storage/test_pickle.py +59 -0
- vinted_api_kit-1.0.0/tests/test_auth.py +62 -0
- vinted_api_kit-1.0.0/tests/test_client.py +40 -0
- vinted_api_kit-1.0.0/tests/test_session.py +138 -0
- vinted_api_kit-1.0.0/tests/test_utils.py +44 -0
- vinted_api_kit-1.0.0/vinted/__init__.py +29 -0
- vinted_api_kit-1.0.0/vinted/api/__init__.py +4 -0
- vinted_api_kit-1.0.0/vinted/api/base.py +32 -0
- vinted_api_kit-1.0.0/vinted/api/catalog.py +129 -0
- vinted_api_kit-1.0.0/vinted/api/items.py +66 -0
- vinted_api_kit-1.0.0/vinted/auth.py +70 -0
- vinted_api_kit-1.0.0/vinted/client.py +180 -0
- vinted_api_kit-1.0.0/vinted/constants.py +76 -0
- vinted_api_kit-1.0.0/vinted/exceptions.py +61 -0
- vinted_api_kit-1.0.0/vinted/models/__init__.py +4 -0
- vinted_api_kit-1.0.0/vinted/models/config.py +38 -0
- vinted_api_kit-1.0.0/vinted/models/item.py +205 -0
- vinted_api_kit-1.0.0/vinted/session.py +187 -0
- vinted_api_kit-1.0.0/vinted/storage/__init__.py +6 -0
- vinted_api_kit-1.0.0/vinted/storage/base.py +52 -0
- vinted_api_kit-1.0.0/vinted/storage/json.py +109 -0
- vinted_api_kit-1.0.0/vinted/storage/mozilla.py +77 -0
- vinted_api_kit-1.0.0/vinted/storage/pickle.py +50 -0
- vinted_api_kit-1.0.0/vinted/utils.py +51 -0
- vinted_api_kit-0.1.0/CHANGELOG.md +0 -32
- vinted_api_kit-0.1.0/Makefile +0 -47
- vinted_api_kit-0.1.0/PKG-INFO +0 -207
- vinted_api_kit-0.1.0/README.md +0 -175
- vinted_api_kit-0.1.0/requiremensts-dev.txt +0 -82
- vinted_api_kit-0.1.0/tests/conftest.py +0 -79
- vinted_api_kit-0.1.0/tests/models/test_catalog_item.py +0 -63
- vinted_api_kit-0.1.0/tests/models/test_detailed_item.py +0 -42
- vinted_api_kit-0.1.0/tests/test_item_service.py +0 -76
- vinted_api_kit-0.1.0/tests/test_user_agents.py +0 -12
- vinted_api_kit-0.1.0/tests/test_vinted_api.py +0 -43
- vinted_api_kit-0.1.0/tests/test_vinted_http_client.py +0 -166
- vinted_api_kit-0.1.0/vinted_api_kit/__init__.py +0 -6
- vinted_api_kit-0.1.0/vinted_api_kit/client/user_agents.py +0 -25
- vinted_api_kit-0.1.0/vinted_api_kit/client/vinted_http_client.py +0 -353
- vinted_api_kit-0.1.0/vinted_api_kit/models/__init__.py +0 -4
- vinted_api_kit-0.1.0/vinted_api_kit/models/catalog_item.py +0 -102
- vinted_api_kit-0.1.0/vinted_api_kit/models/detailed_item.py +0 -140
- vinted_api_kit-0.1.0/vinted_api_kit/services/item_service.py +0 -230
- vinted_api_kit-0.1.0/vinted_api_kit/utils.py +0 -22
- vinted_api_kit-0.1.0/vinted_api_kit/vinted_api.py +0 -120
- {vinted_api_kit-0.1.0 → vinted_api_kit-1.0.0}/.editorconfig +0 -0
- {vinted_api_kit-0.1.0 → vinted_api_kit-1.0.0}/assets/logo.png +0 -0
- {vinted_api_kit-0.1.0 → vinted_api_kit-1.0.0}/tests/__init__.py +0 -0
- {vinted_api_kit-0.1.0/tests/models → vinted_api_kit-1.0.0/tests/api}/__init__.py +0 -0
- {vinted_api_kit-0.1.0/vinted_api_kit/client → vinted_api_kit-1.0.0/tests/models}/__init__.py +0 -0
- {vinted_api_kit-0.1.0/vinted_api_kit/services → vinted_api_kit-1.0.0/tests/storage}/__init__.py +0 -0
- {vinted_api_kit-0.1.0 → vinted_api_kit-1.0.0}/tox.ini +0 -0
|
@@ -20,18 +20,16 @@ jobs:
|
|
|
20
20
|
with:
|
|
21
21
|
python-version: ${{ matrix.python-version }}
|
|
22
22
|
|
|
23
|
-
- name: Install
|
|
23
|
+
- name: Install hatch and create env
|
|
24
24
|
run: |
|
|
25
25
|
python -m pip install --upgrade pip
|
|
26
|
-
pip install
|
|
27
|
-
poetry config virtualenvs.create false
|
|
28
|
-
poetry install --no-interaction --no-ansi --no-root
|
|
26
|
+
pip install hatch
|
|
29
27
|
|
|
30
28
|
- name: Run linting
|
|
31
|
-
run:
|
|
29
|
+
run: hatch run lint
|
|
32
30
|
|
|
33
31
|
- name: Run type check
|
|
34
|
-
run:
|
|
32
|
+
run: hatch run type-check
|
|
35
33
|
|
|
36
34
|
- name: Run tests (no coverage)
|
|
37
|
-
run:
|
|
35
|
+
run: hatch run test
|
|
@@ -20,12 +20,10 @@ jobs:
|
|
|
20
20
|
- name: Install dependencies
|
|
21
21
|
run: |
|
|
22
22
|
python -m pip install --upgrade pip
|
|
23
|
-
pip install
|
|
24
|
-
poetry config virtualenvs.create false
|
|
25
|
-
poetry install --no-interaction --no-ansi --no-root
|
|
23
|
+
pip install hatch
|
|
26
24
|
|
|
27
25
|
- name: Run tests with coverage
|
|
28
|
-
run:
|
|
26
|
+
run: hatch run pytest --cov=vinted --cov-branch --cov-report=xml
|
|
29
27
|
|
|
30
28
|
- name: Upload results to Codecov
|
|
31
29
|
uses: codecov/codecov-action@v5
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## [1.0.0] - 2026-01-05
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- Multiple cookie storage backends: `json`, `mozilla`, and `pickle`
|
|
24
|
+
- Dataclass-based models (`CatalogItem`, `DetailedItem`) for performance and clarity
|
|
25
|
+
- Custom exception hierarchy to surface network, auth, and validation errors distinctly
|
|
26
|
+
- Automatic locale detection from target Vinted URLs
|
|
27
|
+
- `SortOrder` and `StorageFormat` type literals for improved typing
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- Refactored architecture: separated `api/`, `storage/`, and `models/` layers for better maintainability
|
|
31
|
+
- Default cookie storage format changed to `json` for security hardening
|
|
32
|
+
- SSL verification enabled by default for all HTTP requests
|
|
33
|
+
- Proxy configuration simplified to a single string parameter (`proxy="user:pass@host:port"`)
|
|
34
|
+
- Cookie persistence now uses strategy pattern
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
- JWT token expiration parsing (base64url padding handling)
|
|
38
|
+
- Retry/logging behavior for authentication failures
|
|
39
|
+
- Cookie persistence reliability
|
|
40
|
+
- Proxy handling edge cases
|
|
41
|
+
- Token expiration detection accuracy
|
|
42
|
+
|
|
43
|
+
## [0.1.0.post1] - 2025-08-07
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- Logo display compatibility for PyPI
|
|
47
|
+
- Added project badges to README.md for better presentation
|
|
48
|
+
- Corrected CHANGELOG formatting and metadata
|
|
49
|
+
|
|
50
|
+
## [0.1.0] - 2025-08-07
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
- Asynchronous HTTP client for Vinted API with cookie management
|
|
54
|
+
- `VintedApi.search_items()` method for item searching with filters
|
|
55
|
+
- `VintedApi.item_details()` method for detailed item information
|
|
56
|
+
- Support for multiple Vinted domains (fr, de, sk, pl, it, etc.)
|
|
57
|
+
- Proxy support for web scraping
|
|
58
|
+
- Automatic authentication and session handling
|
|
59
|
+
- Cookie persistence between requests
|
|
60
|
+
- JWT token expiration detection and refresh
|
|
61
|
+
- Comprehensive error handling with retry logic
|
|
62
|
+
- Full typing support and async/await patterns
|
|
63
|
+
- CI/CD pipeline with GitHub Actions
|
|
64
|
+
- 80%+ test coverage
|
|
65
|
+
|
|
66
|
+
[Unreleased]: https://github.com/vlymar1/vinted-api-kit/compare/v1.0.0...HEAD
|
|
67
|
+
[1.0.0]: https://github.com/vlymar1/vinted-api-kit/compare/v0.1.0...v1.0.0
|
|
68
|
+
[0.1.0.post1]: https://github.com/vlymar1/vinted-api-kit/compare/v0.1.0...v0.1.0.post1
|
|
69
|
+
[0.1.0]: https://github.com/vlymar1/vinted-api-kit/releases/tag/v0.1.0
|
|
@@ -19,3 +19,9 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
DISCLAIMER:
|
|
24
|
+
This software is intended for personal and lawful use only.
|
|
25
|
+
The authors and copyright holders are not responsible for any misuse of the
|
|
26
|
+
software, including but not limited to violations of applicable laws,
|
|
27
|
+
regulations, or terms of service of third-party platforms.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
package_dir := vinted
|
|
2
|
+
tests_dir := tests
|
|
3
|
+
reports_dir := reports
|
|
4
|
+
|
|
5
|
+
# ===========
|
|
6
|
+
# Environment
|
|
7
|
+
# ===========
|
|
8
|
+
.PHONY: clean
|
|
9
|
+
clean:
|
|
10
|
+
rm -rf `find . -name __pycache__`
|
|
11
|
+
rm -f `find . -type f -name '*.py[co]'`
|
|
12
|
+
rm -f `find . -type f -name '*~'`
|
|
13
|
+
rm -f `find . -type f -name '.*~'`
|
|
14
|
+
rm -rf `find . -name .pytest_cache`
|
|
15
|
+
rm -rf *.egg-info
|
|
16
|
+
rm -f report.html
|
|
17
|
+
rm -f .coverage
|
|
18
|
+
rm -rf {build,dist,.cache,.mypy_cache,.ruff_cache,.hatch,reports,.tox}
|
|
19
|
+
rm -rf htmlcov/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# ===========
|
|
23
|
+
# Development
|
|
24
|
+
# ===========
|
|
25
|
+
.PHONY: install
|
|
26
|
+
install:
|
|
27
|
+
pip install hatch
|
|
28
|
+
|
|
29
|
+
.PHONY: install-dev
|
|
30
|
+
install-dev:
|
|
31
|
+
hatch env create
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
# ============
|
|
35
|
+
# Code quality
|
|
36
|
+
# ============
|
|
37
|
+
.PHONY: lint
|
|
38
|
+
lint:
|
|
39
|
+
hatch run lint
|
|
40
|
+
|
|
41
|
+
.PHONY: lint-check
|
|
42
|
+
lint-check:
|
|
43
|
+
hatch run ruff check $(package_dir)
|
|
44
|
+
hatch run mypy $(package_dir)
|
|
45
|
+
|
|
46
|
+
.PHONY: format
|
|
47
|
+
format:
|
|
48
|
+
hatch run format
|
|
49
|
+
|
|
50
|
+
.PHONY: type-check
|
|
51
|
+
type-check:
|
|
52
|
+
hatch run type-check
|
|
53
|
+
|
|
54
|
+
# ======
|
|
55
|
+
# Tests
|
|
56
|
+
# ======
|
|
57
|
+
.PHONY: test
|
|
58
|
+
test:
|
|
59
|
+
hatch run test
|
|
60
|
+
|
|
61
|
+
.PHONY: test-cov
|
|
62
|
+
test-coverage:
|
|
63
|
+
mkdir -p $(reports_dir)/tests/
|
|
64
|
+
hatch run pytest --cov=$(package_dir) --cov-report=html:$(reports_dir)/coverage --cov-report=term-missing --html=$(reports_dir)/tests/index.html $(tests_dir)
|
|
65
|
+
|
|
66
|
+
.PHONY: test-coverage-view
|
|
67
|
+
test-coverage-view: test-coverage
|
|
68
|
+
python -c "import webbrowser; webbrowser.open('file://$(shell pwd)/$(reports_dir)/coverage/index.html')"
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# =====
|
|
72
|
+
# Build
|
|
73
|
+
# =====
|
|
74
|
+
.PHONY: build
|
|
75
|
+
build: clean
|
|
76
|
+
hatch build
|
|
77
|
+
|
|
78
|
+
.PHONY: publish
|
|
79
|
+
publish: build
|
|
80
|
+
hatch publish
|
|
81
|
+
|
|
82
|
+
.PHONY: publish-test
|
|
83
|
+
publish-test: build
|
|
84
|
+
hatch publish -r test
|
|
85
|
+
|
|
86
|
+
# ===
|
|
87
|
+
# All
|
|
88
|
+
# ===
|
|
89
|
+
.PHONY: all
|
|
90
|
+
all:
|
|
91
|
+
hatch run all
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vinted-api-kit
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Lightweight asynchronous Python client library for accessing Vinted API and scraping item data.
|
|
5
|
+
Project-URL: Homepage, https://github.com/vlymar1/vinted-api-kit
|
|
6
|
+
Project-URL: Documentation, https://github.com/vlymar1/vinted-api-kit
|
|
7
|
+
Project-URL: Repository, https://github.com/vlymar1/vinted-api-kit
|
|
8
|
+
Author-email: Lymar Volodymyr <volodymyr.lymar1@gmail.com>
|
|
9
|
+
Maintainer-email: Lymar Volodymyr <volodymyr.lymar1@gmail.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: api,async,ecommerce,python,vinted,vinted-api,web-scraping
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Framework :: AsyncIO
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Information Technology
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Communications
|
|
25
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
+
Classifier: Topic :: Utilities
|
|
28
|
+
Classifier: Typing :: Typed
|
|
29
|
+
Requires-Python: >=3.10
|
|
30
|
+
Requires-Dist: curl-cffi<0.13.0,>=0.12.0
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
<div align="center">
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
***Lightweight asynchronous Python client library for accessing Vinted API and scraping item data.***
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/vinted-api-kit/)
|
|
40
|
+
[](https://pypi.org/project/vinted-api-kit/)
|
|
41
|
+
[](https://codecov.io/github/vlymar1/vinted-api-kit)
|
|
42
|
+
[](https://pepy.tech/project/vinted-api-kit)
|
|
43
|
+
[](https://github.com/astral-sh/ruff)
|
|
44
|
+
[](http://mypy-lang.org/)
|
|
45
|
+
[](https://github.com/vlymar1/vinted-api-kit/blob/main/LICENSE)
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
## ✨ Features
|
|
49
|
+
|
|
50
|
+
- 🚀 **Asynchronous** - Built with asyncio for high performance
|
|
51
|
+
- 🌍 **Auto-locale Detection** - Automatically detects locale from URL
|
|
52
|
+
- 🔍 **Item Search** - Search catalog with filters, sorting and pagination
|
|
53
|
+
- 📦 **Item Details** - Get complete item information with rich metadata
|
|
54
|
+
- 🍪 **Cookie Persistence** - Automatic session management with multiple storage formats
|
|
55
|
+
- 🔐 **Proxy Support** - Simple string-based proxy configuration
|
|
56
|
+
- 📊 **Type Hints** - Full typing support with Literal types for better IDE experience
|
|
57
|
+
- 🎯 **Dataclass Models** - Fast and efficient data models (15% performance boost) # TODO: Убрать у будущем
|
|
58
|
+
- 🛡️ **Custom Exceptions** - Detailed error hierarchy for precise error handling
|
|
59
|
+
- 💾 **Flexible Storage** - Choose between pickle, JSON, or Mozilla cookie formats
|
|
60
|
+
|
|
61
|
+
## 📚 Table of Contents
|
|
62
|
+
|
|
63
|
+
- [Installation](#installation)
|
|
64
|
+
- [Usage](#usage)
|
|
65
|
+
- [Migration Guide](#migration-guide)
|
|
66
|
+
- [Development](#development)
|
|
67
|
+
- [Changelog](#changelog)
|
|
68
|
+
- [License](#license)
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
Install via pip:
|
|
73
|
+
```bash
|
|
74
|
+
pip install vinted-api-kit
|
|
75
|
+
```
|
|
76
|
+
Or using poetry:
|
|
77
|
+
```bash
|
|
78
|
+
poetry add vinted-api-kit
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
### Basic Example
|
|
84
|
+
```python
|
|
85
|
+
import asyncio
|
|
86
|
+
from vinted import VintedClient
|
|
87
|
+
|
|
88
|
+
async def main():
|
|
89
|
+
async with VintedClient() as client:
|
|
90
|
+
items = await client.search_items(
|
|
91
|
+
url="https://www.vinted.com/catalog?search_text=nike",
|
|
92
|
+
per_page=5
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
for item in items:
|
|
96
|
+
print(f"• {item.title} - {item.price} {item.currency}")
|
|
97
|
+
|
|
98
|
+
asyncio.run(main())
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### Configuration
|
|
104
|
+
|
|
105
|
+
#### 🔐 Proxy Support
|
|
106
|
+
|
|
107
|
+
> Use a proxy by passing a simple connection string:
|
|
108
|
+
```python
|
|
109
|
+
async with VintedClient(
|
|
110
|
+
proxy="user:pass@proxy.example.com:8080" # Format: [user:pass@]host:port
|
|
111
|
+
) as client:
|
|
112
|
+
items = await client.search_items(url)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
#### 💾 Cookie Persistence
|
|
116
|
+
|
|
117
|
+
> Save cookies between sessions to avoid repeated authentication:
|
|
118
|
+
```python
|
|
119
|
+
from pathlib import Path
|
|
120
|
+
|
|
121
|
+
async with VintedClient(
|
|
122
|
+
persist_cookies=True, # Enable persistence
|
|
123
|
+
cookies_dir=Path("./cookies"), # Storage directory
|
|
124
|
+
storage_format="json" # Format: pickle | json | mozilla
|
|
125
|
+
) as client:
|
|
126
|
+
items = await client.search_items(url)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Storage formats:**
|
|
130
|
+
- **`"json"`** (default) - Human-readable, portable across platforms
|
|
131
|
+
- **`"pickle"`** - Fastest, Python-native binary format
|
|
132
|
+
- **`"mozilla"`** - Browser-compatible Netscape format
|
|
133
|
+
|
|
134
|
+
#### 🔍 Search Options
|
|
135
|
+
|
|
136
|
+
> Use type-safe sorting and pagination:
|
|
137
|
+
```python
|
|
138
|
+
from vinted import SortOrder
|
|
139
|
+
|
|
140
|
+
items = await client.search_items(
|
|
141
|
+
url="https://www.vinted.de/catalog?brand_ids[]=53",
|
|
142
|
+
per_page=20, # Items per page (1-96)
|
|
143
|
+
page=1, # Page number
|
|
144
|
+
order="price_low_to_high" # Sort order (IDE auto-complete)
|
|
145
|
+
)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Available sort orders:**
|
|
149
|
+
- `newest_first` - Most recent items
|
|
150
|
+
- `relevance` - Best match
|
|
151
|
+
- `price_low_to_high` - Cheapest first
|
|
152
|
+
- `price_high_to_low` - Most expensive first
|
|
153
|
+
|
|
154
|
+
#### 📦 Raw Data
|
|
155
|
+
|
|
156
|
+
> Get raw JSON dictionaries instead of parsed models:
|
|
157
|
+
```python
|
|
158
|
+
raw_items = await client.search_items(
|
|
159
|
+
url="https://www.vinted.com/catalog?search_text=shoes",
|
|
160
|
+
raw_data=True # Returns list[dict] instead of list[CatalogItem]
|
|
161
|
+
)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
### Item Details
|
|
167
|
+
|
|
168
|
+
> Fetch detailed information about a specific item:
|
|
169
|
+
```python
|
|
170
|
+
item = await client.item_details(
|
|
171
|
+
url="https://www.vinted.com/items/1234567890"
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
print(f"Title: {item.title}")
|
|
175
|
+
print(f"Brand: {item.brand_title}")
|
|
176
|
+
print(f"Size: {item.size_title}")
|
|
177
|
+
print(f"Price: {item.price} {item.currency}")
|
|
178
|
+
print(f"Total: {item.total_item_price}")
|
|
179
|
+
print(f"Description: {item.description}")
|
|
180
|
+
|
|
181
|
+
# Or get raw JSON
|
|
182
|
+
raw_item = await client.item_details(url, raw_data=True)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Parameters
|
|
186
|
+
|
|
187
|
+
| Parameter | Type | Default | Description |
|
|
188
|
+
|-----------|------|---------|-------------|
|
|
189
|
+
| `proxy` | `str \| None` | `None` | Proxy string: `"user:pass@host:port"` or `"host:port"` |
|
|
190
|
+
| `cookies_dir` | `Path \| None` | `Path(".")` | Directory for cookie storage |
|
|
191
|
+
| `persist_cookies` | `bool` | `False` | Enable cookie persistence between sessions |
|
|
192
|
+
| `storage_format` | `"json" \| "pickle" \| "mozilla"` | `"json"` | Cookie storage format |
|
|
193
|
+
|
|
194
|
+
**Storage formats:** `json` (default), `pickle`, `mozilla`. See [Storage Formats](#storage-formats:) for details.
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
### Exception Handling
|
|
199
|
+
```python
|
|
200
|
+
from vinted import (
|
|
201
|
+
VintedClient,
|
|
202
|
+
VintedError, # Base exception
|
|
203
|
+
VintedAPIError, # API errors (4xx, 5xx)
|
|
204
|
+
VintedAuthError, # Authentication failures
|
|
205
|
+
VintedNetworkError, # Network/connection errors
|
|
206
|
+
VintedConfigError, # Invalid configuration
|
|
207
|
+
VintedValidationError, # Input validation errors
|
|
208
|
+
VintedRateLimitError, # Rate limiting (429)
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
try:
|
|
212
|
+
async with VintedClient(proxy="invalid://proxy") as client:
|
|
213
|
+
items = await client.search_items(url)
|
|
214
|
+
except VintedConfigError as e:
|
|
215
|
+
print(f"Configuration error: {e}")
|
|
216
|
+
except VintedValidationError as e:
|
|
217
|
+
print(f"Invalid input: {e}")
|
|
218
|
+
except VintedRateLimitError as e:
|
|
219
|
+
print(f"Rate limited: {e.status_code}")
|
|
220
|
+
except VintedAuthError as e:
|
|
221
|
+
print(f"Auth failed: {e}")
|
|
222
|
+
except VintedNetworkError as e:
|
|
223
|
+
print(f"Network error: {e.original_error}")
|
|
224
|
+
except VintedAPIError as e:
|
|
225
|
+
print(f"API error: {e.status_code}")
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
## Migration Guide
|
|
231
|
+
### (v0.x → v1.0)
|
|
232
|
+
### Breaking Changes
|
|
233
|
+
|
|
234
|
+
If you're upgrading from version 0.x, here are the key changes:
|
|
235
|
+
|
|
236
|
+
#### 1. Import Path Changed
|
|
237
|
+
```python
|
|
238
|
+
# ❌ Old (v0.x)
|
|
239
|
+
from vinted_api_kit import VintedApi
|
|
240
|
+
|
|
241
|
+
# ✅ New (v1.0)
|
|
242
|
+
from vinted import VintedClient
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### 2. Class Renamed
|
|
246
|
+
```python
|
|
247
|
+
# ❌ Old
|
|
248
|
+
async with VintedApi() as api:
|
|
249
|
+
pass
|
|
250
|
+
|
|
251
|
+
# ✅ New
|
|
252
|
+
async with VintedClient() as client:
|
|
253
|
+
pass
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
#### 3. Locale Parameter Removed
|
|
257
|
+
```python
|
|
258
|
+
# ❌ Old (manual locale)
|
|
259
|
+
async with VintedApi(locale="fr") as api:
|
|
260
|
+
items = await api.search_items(url)
|
|
261
|
+
|
|
262
|
+
# ✅ New (auto-detected from URL)
|
|
263
|
+
async with VintedClient() as client:
|
|
264
|
+
items = await client.search_items(url) # Locale detected from URL
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
#### 4. Proxy Configuration Changed
|
|
268
|
+
```python
|
|
269
|
+
# ❌ Old (dict format)
|
|
270
|
+
async with VintedApi(
|
|
271
|
+
proxies={"http": "http://user:pass@proxy:8080"}
|
|
272
|
+
) as api:
|
|
273
|
+
pass
|
|
274
|
+
|
|
275
|
+
# ✅ New (simple string)
|
|
276
|
+
async with VintedClient(
|
|
277
|
+
proxy="user:pass@proxy:8080" # ← Without "http://"
|
|
278
|
+
) as client:
|
|
279
|
+
pass
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
#### 5. New Storage Format Option
|
|
283
|
+
```python
|
|
284
|
+
# ✅ New feature in v1.0
|
|
285
|
+
async with VintedClient(
|
|
286
|
+
persist_cookies=True,
|
|
287
|
+
storage_format="json" # Choose: "json", "pickle", "mozilla"
|
|
288
|
+
) as client:
|
|
289
|
+
pass
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Quick Migration Checklist
|
|
293
|
+
|
|
294
|
+
- [ ] Change import: `vinted_api_kit` → `vinted`
|
|
295
|
+
- [ ] Rename class: `VintedApi` → `VintedClient`
|
|
296
|
+
- [ ] Remove `locale` parameter (auto-detected)
|
|
297
|
+
- [ ] Update proxy format: dict → string
|
|
298
|
+
- [ ] Optional: Choose storage format
|
|
299
|
+
|
|
300
|
+
### Full Example
|
|
301
|
+
|
|
302
|
+
**Before (v0.x):**
|
|
303
|
+
```python
|
|
304
|
+
from vinted_api_kit import VintedApi
|
|
305
|
+
|
|
306
|
+
async with VintedApi(
|
|
307
|
+
locale="fr",
|
|
308
|
+
proxies={"http": "http://proxy:8080"},
|
|
309
|
+
persist_cookies=True
|
|
310
|
+
) as api:
|
|
311
|
+
items = await api.search_items(
|
|
312
|
+
url="https://www.vinted.fr/catalog?search_text=nike"
|
|
313
|
+
)
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**After (v1.0):**
|
|
317
|
+
```python
|
|
318
|
+
from vinted import VintedClient
|
|
319
|
+
|
|
320
|
+
async with VintedClient(
|
|
321
|
+
proxy="proxy:8080",
|
|
322
|
+
persist_cookies=True,
|
|
323
|
+
storage_format="pickle" # New option!
|
|
324
|
+
) as client:
|
|
325
|
+
items = await client.search_items(
|
|
326
|
+
url="https://www.vinted.fr/catalog?search_text=nike"
|
|
327
|
+
)
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
## Development
|
|
332
|
+
|
|
333
|
+
### Setup
|
|
334
|
+
```bash
|
|
335
|
+
git clone https://github.com/vlymar1/vinted-api-kit.git
|
|
336
|
+
cd vinted-api-kit
|
|
337
|
+
|
|
338
|
+
pip install hatch
|
|
339
|
+
hatch shell
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Project Structure
|
|
343
|
+
```
|
|
344
|
+
vinted-api-kit/
|
|
345
|
+
├── vinted/ # Main package
|
|
346
|
+
│ ├── api/ # API endpoint handlers
|
|
347
|
+
│ ├── models/ # Data models (dataclasses)
|
|
348
|
+
│ ├── storage/ # Cookie storage strategies
|
|
349
|
+
│ ├── client.py # Main client (VintedClient)
|
|
350
|
+
│ ├── session.py # HTTP session management
|
|
351
|
+
│ ├── auth.py # Authentication logic
|
|
352
|
+
│ ├── constants.py # Constants and type definitions
|
|
353
|
+
│ ├── exceptions.py # Custom exceptions
|
|
354
|
+
│ └── utils.py # Utility functions
|
|
355
|
+
├── tests/ # Test suite
|
|
356
|
+
└── examples/ # Usage examples
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Testing
|
|
360
|
+
```bash
|
|
361
|
+
make test-coverage # Run tests with coverage
|
|
362
|
+
make test-coverage-view # View coverage report in browser
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Code Quality
|
|
366
|
+
```bash
|
|
367
|
+
make lint-check # Check code with ruff and mypy
|
|
368
|
+
make lint-reformat # Format and fix code with ruff
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
### Cleanup
|
|
372
|
+
```bash
|
|
373
|
+
make clean # Remove cache files and build artifacts
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
### Development Guidelines
|
|
377
|
+
|
|
378
|
+
- Follow PEP 8 style guidelines
|
|
379
|
+
- Use type hints for all functions
|
|
380
|
+
- Write tests for new features
|
|
381
|
+
- Update CHANGELOG.md for notable changes
|
|
382
|
+
- Run `make lint-check` before committing
|
|
383
|
+
- Contributions welcome! Open issues or pull requests
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
## Changelog
|
|
387
|
+
|
|
388
|
+
See [`CHANGELOG.md`](CHANGELOG.md) for the list of notable changes per version.
|
|
389
|
+
|
|
390
|
+
### How to create and maintain changelog?
|
|
391
|
+
|
|
392
|
+
- Start a `CHANGELOG.md` file at the root of your repo.
|
|
393
|
+
- Follow [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format for consistent structure.
|
|
394
|
+
- For each release version, record:
|
|
395
|
+
- Added — new features
|
|
396
|
+
- Changed — updates/improvements
|
|
397
|
+
- Fixed — bug fixes
|
|
398
|
+
- Removed — deprecated or removed features
|
|
399
|
+
- Update changelog **before** tagging a new release (e.g., `v1.0.0`).
|
|
400
|
+
- Automate changelog generation optionally by tools such as:
|
|
401
|
+
- [github-changelog-generator](https://github.com/github-changelog-generator/github-changelog-generator)
|
|
402
|
+
- [auto-changelog](https://github.com/CookPete/auto-changelog)
|
|
403
|
+
- Conventional commits combined with [semantic-release](https://semantic-release.gitbook.io/semantic-release/)
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
## License
|
|
407
|
+
|
|
408
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
409
|
+
|
|
410
|
+
_⚠ Disclaimer_
|
|
411
|
+
|
|
412
|
+
This library is intended for personal and lawful use only.
|
|
413
|
+
The author is not responsible for any misuse, including but not limited to:
|
|
414
|
+
- Violations of applicable laws or regulations
|
|
415
|
+
- Breaches of terms of service of third-party websites
|
|
416
|
+
|
|
417
|
+
_By using this library, you agree that you are solely responsible for your actions._
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
## Maintainers / Contacts
|
|
421
|
+
|
|
422
|
+
- GitHub: [https://github.com/vlymar1](https://github.com/vlymar1)
|
|
423
|
+
|
|
424
|
+
Feel free to open issues or contact for support and collaborations.
|