upcdatabase 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.
- upcdatabase-0.1.0/LICENSE +21 -0
- upcdatabase-0.1.0/MANIFEST.in +5 -0
- upcdatabase-0.1.0/PKG-INFO +270 -0
- upcdatabase-0.1.0/README.md +236 -0
- upcdatabase-0.1.0/pyproject.toml +64 -0
- upcdatabase-0.1.0/setup.cfg +4 -0
- upcdatabase-0.1.0/setup.py +7 -0
- upcdatabase-0.1.0/src/upcdatabase/__init__.py +13 -0
- upcdatabase-0.1.0/src/upcdatabase/client.py +303 -0
- upcdatabase-0.1.0/src/upcdatabase.egg-info/PKG-INFO +270 -0
- upcdatabase-0.1.0/src/upcdatabase.egg-info/SOURCES.txt +14 -0
- upcdatabase-0.1.0/src/upcdatabase.egg-info/dependency_links.txt +1 -0
- upcdatabase-0.1.0/src/upcdatabase.egg-info/requires.txt +10 -0
- upcdatabase-0.1.0/src/upcdatabase.egg-info/top_level.txt +1 -0
- upcdatabase-0.1.0/tests/__init__.py +105 -0
- upcdatabase-0.1.0/tests/test_client.py +279 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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.
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: upcdatabase
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python library for accessing the UPC Database API
|
|
5
|
+
Author-email: Your Name <your.email@example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Nickatak/upcdatabase
|
|
8
|
+
Project-URL: Repository, https://github.com/Nickatak/upcdatabase.git
|
|
9
|
+
Project-URL: Documentation, https://github.com/Nickatak/upcdatabase#readme
|
|
10
|
+
Project-URL: Issues, https://github.com/Nickatak/upcdatabase/issues
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.7
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: requests>=2.25.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=6.0.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-cov>=2.12.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pylint>=2.8.0; extra == "dev"
|
|
29
|
+
Requires-Dist: black>=21.0; extra == "dev"
|
|
30
|
+
Requires-Dist: isort>=5.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: mypy>=0.900; extra == "dev"
|
|
32
|
+
Requires-Dist: pre-commit>=2.20.0; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# upcdatabase
|
|
36
|
+
|
|
37
|
+
A Python library for accessing the [UPC Database API](https://upcdatabase.org/). Look up product information by UPC/EAN code, search for products, access currency and Bitcoin data, and more.
|
|
38
|
+
|
|
39
|
+
## Features
|
|
40
|
+
|
|
41
|
+
- **Product Lookup**: Find product information by UPC or EAN code
|
|
42
|
+
- **Search**: Search for products by name or query
|
|
43
|
+
- **Currency Data**: Get latest and historical currency exchange rates
|
|
44
|
+
- **Bitcoin Data**: Access Bitcoin exchange rate information
|
|
45
|
+
- **QR Code Generation**: Generate QR codes programmatically
|
|
46
|
+
- **Account Management**: Access your API account information
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
Install from PyPI:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install upcdatabase
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Project Structure
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
upcdatabase/
|
|
60
|
+
├── src/upcdatabase/
|
|
61
|
+
│ ├── __init__.py # Package initialization and exports
|
|
62
|
+
│ └── client.py # Main UPCDatabase API client
|
|
63
|
+
├── tests/
|
|
64
|
+
│ ├── __init__.py
|
|
65
|
+
│ └── test_client.py # Unit tests (17 tests, 100% coverage)
|
|
66
|
+
├── examples.py # Usage examples for all endpoints
|
|
67
|
+
├── README.md # Main documentation
|
|
68
|
+
├── QUICKSTART.md # Quick start guide
|
|
69
|
+
├── CONTRIBUTING.md # Contribution guidelines
|
|
70
|
+
├── PUBLISHING.md # PyPI publishing guide
|
|
71
|
+
├── pyproject.toml # Project configuration and metadata
|
|
72
|
+
├── .pre-commit-config.yaml # Pre-commit hooks (linting, formatting, tests)
|
|
73
|
+
└── requirements-dev.txt # Development dependencies
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Quick Start
|
|
77
|
+
|
|
78
|
+
First, you'll need an API key from [UPC Database](https://upcdatabase.org/):
|
|
79
|
+
|
|
80
|
+
1. Create a free account at https://upcdatabase.org/signup
|
|
81
|
+
2. Register your application at https://upcdatabase.org/apikeys to get your API key
|
|
82
|
+
|
|
83
|
+
Then use the library:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from upcdatabase import UPCDatabase
|
|
87
|
+
|
|
88
|
+
# Initialize the client
|
|
89
|
+
client = UPCDatabase(api_key="your_api_key_here")
|
|
90
|
+
|
|
91
|
+
# Look up a product by UPC
|
|
92
|
+
product = client.lookup("036000291204")
|
|
93
|
+
print(product["name"])
|
|
94
|
+
print(product["price"])
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Usage Examples
|
|
98
|
+
|
|
99
|
+
### Product Lookup
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
from upcdatabase import UPCDatabase
|
|
103
|
+
|
|
104
|
+
client = UPCDatabase(api_key="your_api_key")
|
|
105
|
+
|
|
106
|
+
# Look up by UPC code
|
|
107
|
+
product = client.lookup("036000291204")
|
|
108
|
+
print(f"Product: {product['name']}")
|
|
109
|
+
print(f"Manufacturer: {product['manufacturer']}")
|
|
110
|
+
print(f"Price: ${product['price']}")
|
|
111
|
+
print(f"Image: {product['image']}")
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Search Products
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
# Search for products
|
|
118
|
+
results = client.search("coca cola", limit=20)
|
|
119
|
+
for item in results.get("items", []):
|
|
120
|
+
print(f"{item['name']} - {item['upc']}")
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Get Currency Data
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
# Latest currency rates
|
|
127
|
+
rates = client.get_latest_currency()
|
|
128
|
+
print(rates)
|
|
129
|
+
|
|
130
|
+
# Historical rates
|
|
131
|
+
history = client.get_currency_history("2025-01-15")
|
|
132
|
+
print(history)
|
|
133
|
+
|
|
134
|
+
# Available symbols
|
|
135
|
+
symbols = client.get_currency_symbols()
|
|
136
|
+
print(symbols)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Get Bitcoin Data
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
# Latest Bitcoin rate
|
|
143
|
+
btc = client.get_latest_bitcoin()
|
|
144
|
+
print(f"BTC: ${btc['price']}")
|
|
145
|
+
|
|
146
|
+
# Historical Bitcoin rate
|
|
147
|
+
btc_history = client.get_bitcoin_history("2025-01-15")
|
|
148
|
+
print(btc_history)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Generate QR Codes
|
|
152
|
+
|
|
153
|
+
```python
|
|
154
|
+
# Generate a QR code
|
|
155
|
+
qr = client.generate_qr("https://example.com")
|
|
156
|
+
print(qr)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Get Account Information
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
# Check account and API usage
|
|
163
|
+
account = client.get_account_info()
|
|
164
|
+
print(f"Requests remaining: {account['requests_remaining']}")
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Using as a Context Manager
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from upcdatabase import UPCDatabase
|
|
171
|
+
|
|
172
|
+
# The session will be automatically closed when exiting the block
|
|
173
|
+
with UPCDatabase(api_key="your_api_key") as client:
|
|
174
|
+
product = client.lookup("036000291204")
|
|
175
|
+
print(product["name"])
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Error Handling
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
from upcdatabase import UPCDatabase, UPCDatabaseError
|
|
182
|
+
|
|
183
|
+
client = UPCDatabase(api_key="your_api_key")
|
|
184
|
+
|
|
185
|
+
try:
|
|
186
|
+
product = client.lookup("invalid_code")
|
|
187
|
+
except UPCDatabaseError as e:
|
|
188
|
+
print(f"Error: {e}")
|
|
189
|
+
except Exception as e:
|
|
190
|
+
print(f"Unexpected error: {e}")
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## API Documentation
|
|
194
|
+
|
|
195
|
+
For detailed API documentation, visit:
|
|
196
|
+
- [API Reference](https://upcdatabase.org/api)
|
|
197
|
+
- [Authentication](https://upcdatabase.org/api-auth)
|
|
198
|
+
- [API Limits](https://upcdatabase.org/api-limits)
|
|
199
|
+
- [Pricing](https://upcdatabase.org/api-pricing)
|
|
200
|
+
|
|
201
|
+
## Documentation
|
|
202
|
+
|
|
203
|
+
### Client Methods
|
|
204
|
+
|
|
205
|
+
#### `lookup(upc: str) -> dict`
|
|
206
|
+
Look up a product by UPC or EAN code.
|
|
207
|
+
|
|
208
|
+
**Parameters:**
|
|
209
|
+
- `upc` (str): The UPC or EAN code to lookup
|
|
210
|
+
|
|
211
|
+
**Returns:** Product information dictionary
|
|
212
|
+
|
|
213
|
+
**Raises:** `UPCDatabaseError` if lookup fails
|
|
214
|
+
|
|
215
|
+
#### `search(query: str, limit: int = 10) -> dict`
|
|
216
|
+
Search for products by name or query.
|
|
217
|
+
|
|
218
|
+
**Parameters:**
|
|
219
|
+
- `query` (str): Search query string
|
|
220
|
+
- `limit` (int): Maximum number of results (default: 10)
|
|
221
|
+
|
|
222
|
+
**Returns:** Search results dictionary
|
|
223
|
+
|
|
224
|
+
#### `get_latest_currency() -> dict`
|
|
225
|
+
Get latest currency exchange rates.
|
|
226
|
+
|
|
227
|
+
#### `get_currency_history(date: str) -> dict`
|
|
228
|
+
Get historical currency rates for a specific date.
|
|
229
|
+
|
|
230
|
+
**Parameters:**
|
|
231
|
+
- `date` (str): Date in YYYY-MM-DD format
|
|
232
|
+
|
|
233
|
+
#### `get_currency_symbols() -> dict`
|
|
234
|
+
Get list of supported currency symbols.
|
|
235
|
+
|
|
236
|
+
#### `get_latest_bitcoin() -> dict`
|
|
237
|
+
Get latest Bitcoin exchange rate.
|
|
238
|
+
|
|
239
|
+
#### `get_bitcoin_history(date: str) -> dict`
|
|
240
|
+
Get historical Bitcoin rate for a specific date.
|
|
241
|
+
|
|
242
|
+
#### `generate_qr(text: str) -> dict`
|
|
243
|
+
Generate a QR code from text/data.
|
|
244
|
+
|
|
245
|
+
**Parameters:**
|
|
246
|
+
- `text` (str): Text to encode in the QR code
|
|
247
|
+
|
|
248
|
+
#### `get_account_info() -> dict`
|
|
249
|
+
Get account and API usage information.
|
|
250
|
+
|
|
251
|
+
## Requirements
|
|
252
|
+
|
|
253
|
+
- Python 3.7+
|
|
254
|
+
- `requests` library
|
|
255
|
+
|
|
256
|
+
## License
|
|
257
|
+
|
|
258
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
259
|
+
|
|
260
|
+
## Contributing
|
|
261
|
+
|
|
262
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
263
|
+
|
|
264
|
+
## Disclaimer
|
|
265
|
+
|
|
266
|
+
This library is not affiliated with or endorsed by UPC Database. It is an independent client library for accessing the public UPC Database API.
|
|
267
|
+
|
|
268
|
+
## Support
|
|
269
|
+
|
|
270
|
+
For issues, questions, or suggestions, please open an issue on the GitHub repository.
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# upcdatabase
|
|
2
|
+
|
|
3
|
+
A Python library for accessing the [UPC Database API](https://upcdatabase.org/). Look up product information by UPC/EAN code, search for products, access currency and Bitcoin data, and more.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Product Lookup**: Find product information by UPC or EAN code
|
|
8
|
+
- **Search**: Search for products by name or query
|
|
9
|
+
- **Currency Data**: Get latest and historical currency exchange rates
|
|
10
|
+
- **Bitcoin Data**: Access Bitcoin exchange rate information
|
|
11
|
+
- **QR Code Generation**: Generate QR codes programmatically
|
|
12
|
+
- **Account Management**: Access your API account information
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
Install from PyPI:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install upcdatabase
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Project Structure
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
upcdatabase/
|
|
26
|
+
├── src/upcdatabase/
|
|
27
|
+
│ ├── __init__.py # Package initialization and exports
|
|
28
|
+
│ └── client.py # Main UPCDatabase API client
|
|
29
|
+
├── tests/
|
|
30
|
+
│ ├── __init__.py
|
|
31
|
+
│ └── test_client.py # Unit tests (17 tests, 100% coverage)
|
|
32
|
+
├── examples.py # Usage examples for all endpoints
|
|
33
|
+
├── README.md # Main documentation
|
|
34
|
+
├── QUICKSTART.md # Quick start guide
|
|
35
|
+
├── CONTRIBUTING.md # Contribution guidelines
|
|
36
|
+
├── PUBLISHING.md # PyPI publishing guide
|
|
37
|
+
├── pyproject.toml # Project configuration and metadata
|
|
38
|
+
├── .pre-commit-config.yaml # Pre-commit hooks (linting, formatting, tests)
|
|
39
|
+
└── requirements-dev.txt # Development dependencies
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
First, you'll need an API key from [UPC Database](https://upcdatabase.org/):
|
|
45
|
+
|
|
46
|
+
1. Create a free account at https://upcdatabase.org/signup
|
|
47
|
+
2. Register your application at https://upcdatabase.org/apikeys to get your API key
|
|
48
|
+
|
|
49
|
+
Then use the library:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from upcdatabase import UPCDatabase
|
|
53
|
+
|
|
54
|
+
# Initialize the client
|
|
55
|
+
client = UPCDatabase(api_key="your_api_key_here")
|
|
56
|
+
|
|
57
|
+
# Look up a product by UPC
|
|
58
|
+
product = client.lookup("036000291204")
|
|
59
|
+
print(product["name"])
|
|
60
|
+
print(product["price"])
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Usage Examples
|
|
64
|
+
|
|
65
|
+
### Product Lookup
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
from upcdatabase import UPCDatabase
|
|
69
|
+
|
|
70
|
+
client = UPCDatabase(api_key="your_api_key")
|
|
71
|
+
|
|
72
|
+
# Look up by UPC code
|
|
73
|
+
product = client.lookup("036000291204")
|
|
74
|
+
print(f"Product: {product['name']}")
|
|
75
|
+
print(f"Manufacturer: {product['manufacturer']}")
|
|
76
|
+
print(f"Price: ${product['price']}")
|
|
77
|
+
print(f"Image: {product['image']}")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Search Products
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
# Search for products
|
|
84
|
+
results = client.search("coca cola", limit=20)
|
|
85
|
+
for item in results.get("items", []):
|
|
86
|
+
print(f"{item['name']} - {item['upc']}")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Get Currency Data
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
# Latest currency rates
|
|
93
|
+
rates = client.get_latest_currency()
|
|
94
|
+
print(rates)
|
|
95
|
+
|
|
96
|
+
# Historical rates
|
|
97
|
+
history = client.get_currency_history("2025-01-15")
|
|
98
|
+
print(history)
|
|
99
|
+
|
|
100
|
+
# Available symbols
|
|
101
|
+
symbols = client.get_currency_symbols()
|
|
102
|
+
print(symbols)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Get Bitcoin Data
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
# Latest Bitcoin rate
|
|
109
|
+
btc = client.get_latest_bitcoin()
|
|
110
|
+
print(f"BTC: ${btc['price']}")
|
|
111
|
+
|
|
112
|
+
# Historical Bitcoin rate
|
|
113
|
+
btc_history = client.get_bitcoin_history("2025-01-15")
|
|
114
|
+
print(btc_history)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Generate QR Codes
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
# Generate a QR code
|
|
121
|
+
qr = client.generate_qr("https://example.com")
|
|
122
|
+
print(qr)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Get Account Information
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
# Check account and API usage
|
|
129
|
+
account = client.get_account_info()
|
|
130
|
+
print(f"Requests remaining: {account['requests_remaining']}")
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Using as a Context Manager
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
from upcdatabase import UPCDatabase
|
|
137
|
+
|
|
138
|
+
# The session will be automatically closed when exiting the block
|
|
139
|
+
with UPCDatabase(api_key="your_api_key") as client:
|
|
140
|
+
product = client.lookup("036000291204")
|
|
141
|
+
print(product["name"])
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Error Handling
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
from upcdatabase import UPCDatabase, UPCDatabaseError
|
|
148
|
+
|
|
149
|
+
client = UPCDatabase(api_key="your_api_key")
|
|
150
|
+
|
|
151
|
+
try:
|
|
152
|
+
product = client.lookup("invalid_code")
|
|
153
|
+
except UPCDatabaseError as e:
|
|
154
|
+
print(f"Error: {e}")
|
|
155
|
+
except Exception as e:
|
|
156
|
+
print(f"Unexpected error: {e}")
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## API Documentation
|
|
160
|
+
|
|
161
|
+
For detailed API documentation, visit:
|
|
162
|
+
- [API Reference](https://upcdatabase.org/api)
|
|
163
|
+
- [Authentication](https://upcdatabase.org/api-auth)
|
|
164
|
+
- [API Limits](https://upcdatabase.org/api-limits)
|
|
165
|
+
- [Pricing](https://upcdatabase.org/api-pricing)
|
|
166
|
+
|
|
167
|
+
## Documentation
|
|
168
|
+
|
|
169
|
+
### Client Methods
|
|
170
|
+
|
|
171
|
+
#### `lookup(upc: str) -> dict`
|
|
172
|
+
Look up a product by UPC or EAN code.
|
|
173
|
+
|
|
174
|
+
**Parameters:**
|
|
175
|
+
- `upc` (str): The UPC or EAN code to lookup
|
|
176
|
+
|
|
177
|
+
**Returns:** Product information dictionary
|
|
178
|
+
|
|
179
|
+
**Raises:** `UPCDatabaseError` if lookup fails
|
|
180
|
+
|
|
181
|
+
#### `search(query: str, limit: int = 10) -> dict`
|
|
182
|
+
Search for products by name or query.
|
|
183
|
+
|
|
184
|
+
**Parameters:**
|
|
185
|
+
- `query` (str): Search query string
|
|
186
|
+
- `limit` (int): Maximum number of results (default: 10)
|
|
187
|
+
|
|
188
|
+
**Returns:** Search results dictionary
|
|
189
|
+
|
|
190
|
+
#### `get_latest_currency() -> dict`
|
|
191
|
+
Get latest currency exchange rates.
|
|
192
|
+
|
|
193
|
+
#### `get_currency_history(date: str) -> dict`
|
|
194
|
+
Get historical currency rates for a specific date.
|
|
195
|
+
|
|
196
|
+
**Parameters:**
|
|
197
|
+
- `date` (str): Date in YYYY-MM-DD format
|
|
198
|
+
|
|
199
|
+
#### `get_currency_symbols() -> dict`
|
|
200
|
+
Get list of supported currency symbols.
|
|
201
|
+
|
|
202
|
+
#### `get_latest_bitcoin() -> dict`
|
|
203
|
+
Get latest Bitcoin exchange rate.
|
|
204
|
+
|
|
205
|
+
#### `get_bitcoin_history(date: str) -> dict`
|
|
206
|
+
Get historical Bitcoin rate for a specific date.
|
|
207
|
+
|
|
208
|
+
#### `generate_qr(text: str) -> dict`
|
|
209
|
+
Generate a QR code from text/data.
|
|
210
|
+
|
|
211
|
+
**Parameters:**
|
|
212
|
+
- `text` (str): Text to encode in the QR code
|
|
213
|
+
|
|
214
|
+
#### `get_account_info() -> dict`
|
|
215
|
+
Get account and API usage information.
|
|
216
|
+
|
|
217
|
+
## Requirements
|
|
218
|
+
|
|
219
|
+
- Python 3.7+
|
|
220
|
+
- `requests` library
|
|
221
|
+
|
|
222
|
+
## License
|
|
223
|
+
|
|
224
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
225
|
+
|
|
226
|
+
## Contributing
|
|
227
|
+
|
|
228
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
229
|
+
|
|
230
|
+
## Disclaimer
|
|
231
|
+
|
|
232
|
+
This library is not affiliated with or endorsed by UPC Database. It is an independent client library for accessing the public UPC Database API.
|
|
233
|
+
|
|
234
|
+
## Support
|
|
235
|
+
|
|
236
|
+
For issues, questions, or suggestions, please open an issue on the GitHub repository.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=70.0.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "upcdatabase"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Python library for accessing the UPC Database API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.7"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Your Name", email = "your.email@example.com"}
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.7",
|
|
21
|
+
"Programming Language :: Python :: 3.8",
|
|
22
|
+
"Programming Language :: Python :: 3.9",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"requests>=2.25.0",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/Nickatak/upcdatabase"
|
|
33
|
+
Repository = "https://github.com/Nickatak/upcdatabase.git"
|
|
34
|
+
Documentation = "https://github.com/Nickatak/upcdatabase#readme"
|
|
35
|
+
Issues = "https://github.com/Nickatak/upcdatabase/issues"
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
dev = [
|
|
39
|
+
"pytest>=6.0.0",
|
|
40
|
+
"pytest-cov>=2.12.0",
|
|
41
|
+
"pylint>=2.8.0",
|
|
42
|
+
"black>=21.0",
|
|
43
|
+
"isort>=5.0.0",
|
|
44
|
+
"mypy>=0.900",
|
|
45
|
+
"pre-commit>=2.20.0",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
where = ["src"]
|
|
50
|
+
|
|
51
|
+
[tool.black]
|
|
52
|
+
line-length = 100
|
|
53
|
+
target-version = ["py37"]
|
|
54
|
+
|
|
55
|
+
[tool.isort]
|
|
56
|
+
profile = "black"
|
|
57
|
+
line_length = 100
|
|
58
|
+
|
|
59
|
+
[tool.mypy]
|
|
60
|
+
python_version = "3.7"
|
|
61
|
+
warn_return_any = true
|
|
62
|
+
warn_unused_configs = true
|
|
63
|
+
disallow_untyped_defs = false
|
|
64
|
+
disallow_incomplete_defs = false
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""UPC Database Python Library
|
|
2
|
+
|
|
3
|
+
A Python library for accessing the UPC Database API.
|
|
4
|
+
Access product information, search capabilities, and more.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
__version__ = "0.1.0"
|
|
8
|
+
__author__ = "Your Name"
|
|
9
|
+
__license__ = "MIT"
|
|
10
|
+
|
|
11
|
+
from .client import UPCDatabase, UPCDatabaseError
|
|
12
|
+
|
|
13
|
+
__all__ = ["UPCDatabase", "UPCDatabaseError"]
|