colacloud-cli 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.
- colacloud_cli-0.1.0/.gitignore +157 -0
- colacloud_cli-0.1.0/LICENSE +21 -0
- colacloud_cli-0.1.0/PKG-INFO +304 -0
- colacloud_cli-0.1.0/README.md +277 -0
- colacloud_cli-0.1.0/pyproject.toml +53 -0
- colacloud_cli-0.1.0/src/colacloud_cli/__init__.py +3 -0
- colacloud_cli-0.1.0/src/colacloud_cli/api.py +337 -0
- colacloud_cli-0.1.0/src/colacloud_cli/commands/__init__.py +1 -0
- colacloud_cli-0.1.0/src/colacloud_cli/commands/barcode.py +48 -0
- colacloud_cli-0.1.0/src/colacloud_cli/commands/colas.py +179 -0
- colacloud_cli-0.1.0/src/colacloud_cli/commands/config.py +80 -0
- colacloud_cli-0.1.0/src/colacloud_cli/commands/permittees.py +110 -0
- colacloud_cli-0.1.0/src/colacloud_cli/commands/usage.py +42 -0
- colacloud_cli-0.1.0/src/colacloud_cli/commands/utils.py +35 -0
- colacloud_cli-0.1.0/src/colacloud_cli/config.py +142 -0
- colacloud_cli-0.1.0/src/colacloud_cli/formatters.py +500 -0
- colacloud_cli-0.1.0/src/colacloud_cli/main.py +105 -0
- colacloud_cli-0.1.0/tests/__init__.py +1 -0
- colacloud_cli-0.1.0/tests/test_api.py +236 -0
- colacloud_cli-0.1.0/tests/test_cli.py +286 -0
- colacloud_cli-0.1.0/tests/test_config.py +110 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.nox/
|
|
41
|
+
.coverage
|
|
42
|
+
.coverage.*
|
|
43
|
+
.cache
|
|
44
|
+
nosetests.xml
|
|
45
|
+
coverage.xml
|
|
46
|
+
*.cover
|
|
47
|
+
*.py,cover
|
|
48
|
+
.hypothesis/
|
|
49
|
+
.pytest_cache/
|
|
50
|
+
cover/
|
|
51
|
+
|
|
52
|
+
# Translations
|
|
53
|
+
*.mo
|
|
54
|
+
*.pot
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
local_settings.py
|
|
59
|
+
db.sqlite3
|
|
60
|
+
db.sqlite3-journal
|
|
61
|
+
|
|
62
|
+
# Flask stuff:
|
|
63
|
+
instance/
|
|
64
|
+
.webassets-cache
|
|
65
|
+
|
|
66
|
+
# Scrapy stuff:
|
|
67
|
+
.scrapy
|
|
68
|
+
|
|
69
|
+
# Sphinx documentation
|
|
70
|
+
docs/_build/
|
|
71
|
+
|
|
72
|
+
# PyBuilder
|
|
73
|
+
.pybuilder/
|
|
74
|
+
target/
|
|
75
|
+
|
|
76
|
+
# Jupyter Notebook
|
|
77
|
+
.ipynb_checkpoints
|
|
78
|
+
|
|
79
|
+
# IPython
|
|
80
|
+
profile_default/
|
|
81
|
+
ipython_config.py
|
|
82
|
+
|
|
83
|
+
# pyenv
|
|
84
|
+
.python-version
|
|
85
|
+
|
|
86
|
+
# pipenv
|
|
87
|
+
Pipfile.lock
|
|
88
|
+
|
|
89
|
+
# poetry
|
|
90
|
+
poetry.lock
|
|
91
|
+
|
|
92
|
+
# pdm
|
|
93
|
+
.pdm.toml
|
|
94
|
+
.pdm-python
|
|
95
|
+
.pdm-build/
|
|
96
|
+
|
|
97
|
+
# PEP 582
|
|
98
|
+
__pypackages__/
|
|
99
|
+
|
|
100
|
+
# Celery stuff
|
|
101
|
+
celerybeat-schedule
|
|
102
|
+
celerybeat.pid
|
|
103
|
+
|
|
104
|
+
# SageMath parsed files
|
|
105
|
+
*.sage.py
|
|
106
|
+
|
|
107
|
+
# Environments
|
|
108
|
+
.env
|
|
109
|
+
.venv
|
|
110
|
+
env/
|
|
111
|
+
venv/
|
|
112
|
+
ENV/
|
|
113
|
+
env.bak/
|
|
114
|
+
venv.bak/
|
|
115
|
+
|
|
116
|
+
# Spyder project settings
|
|
117
|
+
.spyderproject
|
|
118
|
+
.spyproject
|
|
119
|
+
|
|
120
|
+
# Rope project settings
|
|
121
|
+
.ropeproject
|
|
122
|
+
|
|
123
|
+
# mkdocs documentation
|
|
124
|
+
/site
|
|
125
|
+
|
|
126
|
+
# mypy
|
|
127
|
+
.mypy_cache/
|
|
128
|
+
.dmypy.json
|
|
129
|
+
dmypy.json
|
|
130
|
+
|
|
131
|
+
# Pyre type checker
|
|
132
|
+
.pyre/
|
|
133
|
+
|
|
134
|
+
# pytype static type analyzer
|
|
135
|
+
.pytype/
|
|
136
|
+
|
|
137
|
+
# Cython debug symbols
|
|
138
|
+
cython_debug/
|
|
139
|
+
|
|
140
|
+
# IDE
|
|
141
|
+
.vscode/
|
|
142
|
+
.idea/
|
|
143
|
+
*.swp
|
|
144
|
+
*.swo
|
|
145
|
+
*~
|
|
146
|
+
|
|
147
|
+
# OS
|
|
148
|
+
.DS_Store
|
|
149
|
+
.DS_Store?
|
|
150
|
+
._*
|
|
151
|
+
.Spotlight-V100
|
|
152
|
+
.Trashes
|
|
153
|
+
ehthumbs.db
|
|
154
|
+
Thumbs.db
|
|
155
|
+
|
|
156
|
+
# Project specific
|
|
157
|
+
*.lock
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 COLA Cloud
|
|
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,304 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: colacloud-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Command-line interface for the COLA Cloud API
|
|
5
|
+
Project-URL: Homepage, https://colacloud.us
|
|
6
|
+
Project-URL: Documentation, https://colacloud.us/docs/api
|
|
7
|
+
Project-URL: Repository, https://github.com/cola-cloud-us/colacloud-cli
|
|
8
|
+
Author-email: Jay Sobel <jay@colacloud.us>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: alcohol,cli,cola,labels,ttb
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Utilities
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: click>=8.1.0
|
|
24
|
+
Requires-Dist: httpx>=0.25.0
|
|
25
|
+
Requires-Dist: rich>=13.0.0
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# COLA Cloud CLI
|
|
29
|
+
|
|
30
|
+
Command-line interface for the [COLA Cloud API](https://colacloud.us) - Access the TTB COLA Registry from your terminal.
|
|
31
|
+
|
|
32
|
+
COLA Cloud provides access to the United States TTB (Alcohol and Tobacco Tax and Trade Bureau) Certificate of Label Approval registry, containing over 1 million alcohol product label records.
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Install with pip
|
|
38
|
+
pip install colacloud-cli
|
|
39
|
+
|
|
40
|
+
# Or with uv
|
|
41
|
+
uv pip install colacloud-cli
|
|
42
|
+
|
|
43
|
+
# Or install from source
|
|
44
|
+
git clone https://github.com/cola-cloud-us/colacloud-cli.git
|
|
45
|
+
cd colacloud-cli
|
|
46
|
+
uv sync
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
After installation, the `cola` command will be available.
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
1. **Get your API key** from [https://app.colacloud.us](https://app.colacloud.us)
|
|
54
|
+
|
|
55
|
+
2. **Configure the CLI:**
|
|
56
|
+
```bash
|
|
57
|
+
cola config set-key
|
|
58
|
+
# Enter your API key when prompted
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
3. **Start searching:**
|
|
62
|
+
```bash
|
|
63
|
+
cola colas search "buffalo trace"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Commands
|
|
67
|
+
|
|
68
|
+
### Configuration
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Set your API key (prompts for input)
|
|
72
|
+
cola config set-key
|
|
73
|
+
|
|
74
|
+
# Set API key directly
|
|
75
|
+
cola config set-key --key "your-api-key"
|
|
76
|
+
|
|
77
|
+
# Show current configuration (API key is masked)
|
|
78
|
+
cola config show
|
|
79
|
+
|
|
80
|
+
# Clear configuration
|
|
81
|
+
cola config clear
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
You can also set the `COLACLOUD_API_KEY` environment variable instead of using the config file.
|
|
85
|
+
|
|
86
|
+
### COLAs
|
|
87
|
+
|
|
88
|
+
Search and retrieve COLA (Certificate of Label Approval) records.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Full-text search
|
|
92
|
+
cola colas search "buffalo trace"
|
|
93
|
+
|
|
94
|
+
# List with filters
|
|
95
|
+
cola colas list --product-type wine --origin california
|
|
96
|
+
|
|
97
|
+
# Filter by date range
|
|
98
|
+
cola colas list --date-from 2024-01-01 --date-to 2024-12-31
|
|
99
|
+
|
|
100
|
+
# Filter by ABV
|
|
101
|
+
cola colas list --product-type "distilled spirits" --abv-min 40 --abv-max 50
|
|
102
|
+
|
|
103
|
+
# Search by brand name
|
|
104
|
+
cola colas list --brand "maker's mark"
|
|
105
|
+
|
|
106
|
+
# Pagination
|
|
107
|
+
cola colas list -q "bourbon" --limit 50 --page 2
|
|
108
|
+
|
|
109
|
+
# Get detailed information about a specific COLA
|
|
110
|
+
cola colas get 24001234
|
|
111
|
+
|
|
112
|
+
# Output as JSON (for scripting)
|
|
113
|
+
cola colas list -q "whiskey" --json | jq '.data[].brand_name'
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### COLA Search Options
|
|
117
|
+
|
|
118
|
+
| Option | Description |
|
|
119
|
+
|--------|-------------|
|
|
120
|
+
| `-q, --query` | Full-text search query |
|
|
121
|
+
| `--product-type` | Filter by type: `malt beverage`, `wine`, `distilled spirits` |
|
|
122
|
+
| `--origin` | Filter by country/state |
|
|
123
|
+
| `--brand` | Filter by brand name (partial match) |
|
|
124
|
+
| `--date-from` | Minimum approval date (YYYY-MM-DD) |
|
|
125
|
+
| `--date-to` | Maximum approval date (YYYY-MM-DD) |
|
|
126
|
+
| `--abv-min` | Minimum ABV percentage |
|
|
127
|
+
| `--abv-max` | Maximum ABV percentage |
|
|
128
|
+
| `--limit` | Results per page (max 100) |
|
|
129
|
+
| `--page` | Page number |
|
|
130
|
+
| `--json` | Output as JSON |
|
|
131
|
+
|
|
132
|
+
### Permittees
|
|
133
|
+
|
|
134
|
+
Search and retrieve permittee (alcohol producer/importer) records.
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Search by company name
|
|
138
|
+
cola permittees list -q "diageo"
|
|
139
|
+
|
|
140
|
+
# Filter by state
|
|
141
|
+
cola permittees list --state KY
|
|
142
|
+
|
|
143
|
+
# Filter by active status
|
|
144
|
+
cola permittees list --state CA --active
|
|
145
|
+
cola permittees list --state NY --inactive
|
|
146
|
+
|
|
147
|
+
# Get detailed information about a specific permittee
|
|
148
|
+
cola permittees get NY-I-136
|
|
149
|
+
|
|
150
|
+
# Output as JSON
|
|
151
|
+
cola permittees list -q "distillery" --json
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### Permittee Search Options
|
|
155
|
+
|
|
156
|
+
| Option | Description |
|
|
157
|
+
|--------|-------------|
|
|
158
|
+
| `-q, --query` | Search by company name |
|
|
159
|
+
| `--state` | Filter by state (e.g., CA, NY, KY) |
|
|
160
|
+
| `--active/--inactive` | Filter by active status |
|
|
161
|
+
| `--limit` | Results per page (max 100) |
|
|
162
|
+
| `--page` | Page number |
|
|
163
|
+
| `--json` | Output as JSON |
|
|
164
|
+
|
|
165
|
+
### Barcode Lookup
|
|
166
|
+
|
|
167
|
+
Look up products by their barcode (UPC, EAN, etc.).
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Look up by UPC
|
|
171
|
+
cola barcode 012345678901
|
|
172
|
+
|
|
173
|
+
# Look up by EAN
|
|
174
|
+
cola barcode 5000281025155
|
|
175
|
+
|
|
176
|
+
# Output as JSON
|
|
177
|
+
cola barcode 012345678901 --json
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Usage Statistics
|
|
181
|
+
|
|
182
|
+
Check your API usage and limits.
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Show usage stats
|
|
186
|
+
cola usage
|
|
187
|
+
|
|
188
|
+
# Output as JSON
|
|
189
|
+
cola usage --json
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Output Examples
|
|
193
|
+
|
|
194
|
+
### COLA List
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
$ cola colas search "buffalo trace"
|
|
198
|
+
+------------+-----------------+-----------------------+------------------+------------+
|
|
199
|
+
| TTB ID | Brand | Product | Type | Approved |
|
|
200
|
+
+============+=================+=======================+==================+============+
|
|
201
|
+
| 24001234 | Buffalo Trace | Kentucky Straight... | distilled spirits| 2024-01-15 |
|
|
202
|
+
| 23098765 | Buffalo Trace | Single Barrel... | distilled spirits| 2023-12-01 |
|
|
203
|
+
+------------+-----------------+-----------------------+------------------+------------+
|
|
204
|
+
Showing 1-2 of 156 results (page 1 of 8)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### COLA Detail
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
$ cola colas get 24001234
|
|
211
|
+
+----------------------------------------------------------+
|
|
212
|
+
| 24001234 |
|
|
213
|
+
| |
|
|
214
|
+
| Buffalo Trace |
|
|
215
|
+
| Kentucky Straight Bourbon Whiskey |
|
|
216
|
+
+----------------------------------------------------------+
|
|
217
|
+
|
|
218
|
+
Basic Information
|
|
219
|
+
Product Type distilled spirits
|
|
220
|
+
Class Whiskey
|
|
221
|
+
Origin Kentucky
|
|
222
|
+
ABV 45.0%
|
|
223
|
+
Volume 750 ml
|
|
224
|
+
|
|
225
|
+
Dates & Status
|
|
226
|
+
Application 2024-01-10
|
|
227
|
+
Approval 2024-01-15
|
|
228
|
+
Status approved
|
|
229
|
+
|
|
230
|
+
Permit Information
|
|
231
|
+
Permit Number KY-DSP-0019
|
|
232
|
+
Application Original Label
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Usage Stats
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
$ cola usage
|
|
239
|
+
+--------------------------------------------------+
|
|
240
|
+
| API Usage Statistics |
|
|
241
|
+
+--------------------------------------------------+
|
|
242
|
+
|
|
243
|
+
Tier standard
|
|
244
|
+
Current Period 2024-01
|
|
245
|
+
Monthly Usage 1,234 / 10,000 (12.3%)
|
|
246
|
+
Remaining 8,766
|
|
247
|
+
Rate Limit 60 requests/minute
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## JSON Output
|
|
251
|
+
|
|
252
|
+
All commands support `--json` flag for scripting and piping to other tools:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Get all bourbon brands
|
|
256
|
+
cola colas list -q "bourbon" --json | jq -r '.data[].brand_name' | sort | uniq
|
|
257
|
+
|
|
258
|
+
# Count COLAs by product type
|
|
259
|
+
cola colas list --json | jq '.data | group_by(.product_type) | map({type: .[0].product_type, count: length})'
|
|
260
|
+
|
|
261
|
+
# Export permittees to CSV
|
|
262
|
+
cola permittees list --state KY --json | jq -r '.data[] | [.permit_number, .company_name, .company_state] | @csv'
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
## Configuration
|
|
266
|
+
|
|
267
|
+
The CLI stores configuration in `~/.colacloud/config.json`. The file is created with restrictive permissions (mode 600) to protect your API key.
|
|
268
|
+
|
|
269
|
+
### Environment Variables
|
|
270
|
+
|
|
271
|
+
| Variable | Description |
|
|
272
|
+
|----------|-------------|
|
|
273
|
+
| `COLACLOUD_API_KEY` | API key (takes precedence over config file) |
|
|
274
|
+
|
|
275
|
+
## Development
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
# Clone the repository
|
|
279
|
+
git clone https://github.com/cola-cloud-us/colacloud-cli.git
|
|
280
|
+
cd colacloud-cli
|
|
281
|
+
|
|
282
|
+
# Install dependencies
|
|
283
|
+
uv sync
|
|
284
|
+
|
|
285
|
+
# Run the CLI in development
|
|
286
|
+
uv run cola --help
|
|
287
|
+
|
|
288
|
+
# Run tests
|
|
289
|
+
uv run pytest
|
|
290
|
+
|
|
291
|
+
# Format code
|
|
292
|
+
uv run black .
|
|
293
|
+
uv run isort .
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## License
|
|
297
|
+
|
|
298
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
299
|
+
|
|
300
|
+
## Links
|
|
301
|
+
|
|
302
|
+
- [COLA Cloud Website](https://colacloud.us)
|
|
303
|
+
- [API Documentation](https://colacloud.us/docs/api)
|
|
304
|
+
- [GitHub Repository](https://github.com/cola-cloud-us/colacloud-cli)
|