Metadata-Version: 2.4
Name: google-patent-cli
Version: 0.1.7
Summary: Google Patents metadata fetcher — command-line tool
Project-URL: Homepage, https://github.com/noaa/gp-cli-public
License: MIT
License-File: LICENSE
Keywords: cli,google-patents,ip,patent,uspto
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Requires-Python: >=3.11
Requires-Dist: beautifulsoup4>=4.12
Requires-Dist: click>=8.0
Requires-Dist: requests>=2.28
Description-Content-Type: text/markdown

# google-patent-cli

A command-line tool to fetch patent metadata from Google Patents.

## Installation

```bash
# pipx (recommended — isolated environment)
pipx install google-patent-cli

# uv
uv tool install google-patent-cli

# pip
pip install google-patent-cli
```

> **Windows users**: If the `gpc` command is not recognized after installation, run `pipx ensurepath` and restart your terminal.

## Update

```bash
# pipx
pipx upgrade google-patent-cli

# uv
uv tool upgrade google-patent-cli

# pip
pip install --upgrade google-patent-cli
```

## Usage

### Fetch a patent

```bash
# Default output (JSON)
gpc lookup US20250350789

# Text format
gpc lookup US12514139B2 --format text

# TSV format
gpc lookup US20250350789 --format tsv

# Single field
gpc lookup US20250350789 --field title

# Multiple fields
gpc lookup US20250350789 --fields title,assignee,filing_date

# Save to file
gpc lookup US12514139B2 --output-dir ./output
gpc lookup US12514139B2 --format text --output-dir ./output
```

### Download patent PDF

```bash
# Save to current directory as US9735861B2.pdf
gpc download US9735861

# Save to a specific directory
gpc download US9735861 --output-dir ./pdfs
```

### List available fields

```bash
gpc fields
```

| Field | Description |
|-------|-------------|
| `publication_number` | Publication number (e.g. US12514139B2) |
| `number_without_kind` | Publication number without kind code |
| `application_number` | Application number |
| `kind_code` | Kind code (e.g. B2, A1) |
| `country` | Country code |
| `title` | Title of the invention |
| `abstract` | Abstract |
| `inventors` | List of inventors |
| `assignee` | Assignee / applicant |
| `filing_date` | Filing date |
| `publication_date` | Publication date |
| `cpc_codes` | CPC classification codes |
| `claims` | List of claims |
| `description` | Full description text |
| `pdf_url` | PDF download URL |
| `patent_url` | Google Patents page URL (with kind code) |

### Proxy / SSL configuration

For corporate networks or proxy environments:

```bash
gpc configure
```

Settings are saved to `~/.patent-cli.toml`:

```toml
[proxy]
https = "http://proxy.example.com:8080"
http  = "http://proxy.example.com:8080"

[ssl]
ca_bundle = "/path/to/ca-bundle.crt"
```

### Options

```
gpc lookup --help

Options:
  -f, --format [json|text|tsv]  Output format (default: json)
  --field FIELD                  Print a single field value
  --fields F1,F2,...             Comma-separated list of fields to include
  -t, --timeout INTEGER          HTTP timeout in seconds (default: 15)
  -o, --output-dir DIR           Directory to save output file
  -v, --verbose                  Print debug logs to stderr
```

## Uninstall

```bash
# pipx
pipx uninstall google-patent-cli

# uv
uv tool uninstall google-patent-cli

# pip
pip uninstall google-patent-cli
```

## Run as a module

```bash
python -m google_patent_cli lookup US12514139B2
```

## Disclaimer

This tool scrapes Google Patents public web pages.
Please comply with Google's Terms of Service.
Excessive requests may result in IP blocking.

## License

MIT
