namecheap-python 1.0.0__tar.gz → 1.0.2__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.
- namecheap_python-1.0.2/.github/cliff.toml +34 -0
- namecheap_python-1.0.2/.github/workflows/git-cliff.yml +33 -0
- namecheap_python-1.0.2/.github/workflows/release.yml +90 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/.pre-commit-config.yaml +0 -12
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/PKG-INFO +73 -68
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/README.md +70 -61
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/examples/quickstart.py +3 -1
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/pyproject.toml +5 -33
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap/_api/base.py +5 -2
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap/_api/dns.py +10 -2
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap/_api/domains.py +24 -8
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap/logging.py +12 -4
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap/models.py +5 -3
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap_cli/__main__.py +128 -45
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap_dns_tui/__main__.py +27 -9
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/uv.lock +236 -232
- namecheap_python-1.0.0/.github/workflows/lint.yml +0 -33
- namecheap_python-1.0.0/.github/workflows/publish.yml +0 -45
- namecheap_python-1.0.0/.github/workflows/release.yml +0 -113
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/.env.example +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/.gitignore +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/CLI.md +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/LICENSE +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/MANIFEST.in +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/docs/dev/README.md +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/examples/README.md +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/pending.md +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap/__init__.py +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap/_api/__init__.py +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap/client.py +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap/errors.py +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap_cli/README.md +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap_cli/__init__.py +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap_cli/completion.py +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap_dns_tui/README.md +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap_dns_tui/__init__.py +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap_dns_tui/assets/screenshot1.png +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap_dns_tui/assets/screenshot2.png +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap_dns_tui/assets/screenshot3.png +0 -0
- {namecheap_python-1.0.0 → namecheap_python-1.0.2}/src/namecheap_dns_tui/assets/screenshot4.png +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[changelog]
|
|
2
|
+
body = """
|
|
3
|
+
{%- macro remote_url() -%}
|
|
4
|
+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
|
|
5
|
+
{%- endmacro -%}
|
|
6
|
+
|
|
7
|
+
{% for group, commits in commits | group_by(attribute="group") %}
|
|
8
|
+
### {{ group | striptags | trim | upper_first }}
|
|
9
|
+
{% for commit in commits %}
|
|
10
|
+
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}{% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }} - ([{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}))
|
|
11
|
+
{%- endfor %}
|
|
12
|
+
{% endfor %}
|
|
13
|
+
"""
|
|
14
|
+
trim = true
|
|
15
|
+
|
|
16
|
+
[git]
|
|
17
|
+
conventional_commits = true
|
|
18
|
+
filter_unconventional = true
|
|
19
|
+
protect_breaking_commits = true
|
|
20
|
+
commit_parsers = [
|
|
21
|
+
{ message = "^feat", group = "✨ Features" },
|
|
22
|
+
{ message = "^fix", group = "🐛 Bug Fixes" },
|
|
23
|
+
{ message = "^doc", group = "📚 Documentation" },
|
|
24
|
+
{ message = "^perf", group = "⚡ Performance" },
|
|
25
|
+
{ message = "^refactor", group = "♻️ Refactor" },
|
|
26
|
+
{ message = "^style", group = "🎨 Styling" },
|
|
27
|
+
{ message = "^test", group = "🧪 Testing" },
|
|
28
|
+
{ message = "^chore\\(release\\): prepare for", skip = true },
|
|
29
|
+
{ message = "^chore\\(deps.*\\)", skip = true },
|
|
30
|
+
{ message = "^chore", group = "🧹 Miscellaneous Tasks" },
|
|
31
|
+
{ message = "^ci|^cd", group = "🏭 CI/CD" },
|
|
32
|
+
{ body = ".*security", group = "🛡️ Security" },
|
|
33
|
+
{ message = "^revert", group = "⏪ Revert" },
|
|
34
|
+
]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Create Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
with:
|
|
16
|
+
fetch-depth: 0
|
|
17
|
+
|
|
18
|
+
- name: Generate Changelog
|
|
19
|
+
id: git-cliff
|
|
20
|
+
uses: orhun/git-cliff-action@v4
|
|
21
|
+
with:
|
|
22
|
+
config: .github/cliff.toml
|
|
23
|
+
args: --latest
|
|
24
|
+
env:
|
|
25
|
+
OUTPUT: CHANGELOG.md
|
|
26
|
+
GITHUB_REPO: ${{ github.repository }}
|
|
27
|
+
|
|
28
|
+
- name: Create GitHub Release
|
|
29
|
+
uses: softprops/action-gh-release@v2
|
|
30
|
+
with:
|
|
31
|
+
body: ${{ steps.git-cliff.outputs.content }}
|
|
32
|
+
draft: false
|
|
33
|
+
prerelease: false
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
name: Python CI/CD
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- name: Install uv
|
|
16
|
+
uses: astral-sh/setup-uv@v5
|
|
17
|
+
with:
|
|
18
|
+
enable-cache: true
|
|
19
|
+
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
run: uv python install 3.12
|
|
22
|
+
|
|
23
|
+
- name: Install dependencies
|
|
24
|
+
run: uv sync --all-extras
|
|
25
|
+
|
|
26
|
+
- name: Run ruff check
|
|
27
|
+
run: uv run ruff check
|
|
28
|
+
|
|
29
|
+
- name: Run ruff format check
|
|
30
|
+
run: uv run ruff format --check
|
|
31
|
+
|
|
32
|
+
publish:
|
|
33
|
+
needs: lint
|
|
34
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
permissions:
|
|
37
|
+
id-token: write
|
|
38
|
+
contents: write
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v4
|
|
41
|
+
with:
|
|
42
|
+
fetch-depth: 0
|
|
43
|
+
|
|
44
|
+
- name: Set up Python
|
|
45
|
+
uses: actions/setup-python@v5
|
|
46
|
+
with:
|
|
47
|
+
python-version: "3.12"
|
|
48
|
+
|
|
49
|
+
- name: Install uv
|
|
50
|
+
uses: astral-sh/setup-uv@v3
|
|
51
|
+
|
|
52
|
+
- name: Build package
|
|
53
|
+
run: uv build
|
|
54
|
+
|
|
55
|
+
- name: Check if version exists on PyPI
|
|
56
|
+
id: check
|
|
57
|
+
run: |
|
|
58
|
+
WHEEL=$(ls dist/*.whl | head -1)
|
|
59
|
+
PACKAGE_NAME=$(echo $WHEEL | cut -d'/' -f2 | cut -d'-' -f1)
|
|
60
|
+
VERSION=$(echo $WHEEL | cut -d'/' -f2 | cut -d'-' -f2)
|
|
61
|
+
|
|
62
|
+
if [ -z "$VERSION" ] || [ -z "$PACKAGE_NAME" ]; then
|
|
63
|
+
echo "Failed to extract package name or version from wheel"
|
|
64
|
+
exit 1
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
echo "package=$PACKAGE_NAME" >> $GITHUB_OUTPUT
|
|
68
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
69
|
+
echo "Checking PyPI for $PACKAGE_NAME version $VERSION"
|
|
70
|
+
|
|
71
|
+
if curl -sf https://pypi.org/pypi/$PACKAGE_NAME/$VERSION/json > /dev/null 2>&1; then
|
|
72
|
+
echo "exists=true" >> $GITHUB_OUTPUT
|
|
73
|
+
echo "Version $VERSION already exists on PyPI"
|
|
74
|
+
else
|
|
75
|
+
echo "exists=false" >> $GITHUB_OUTPUT
|
|
76
|
+
echo "Version $VERSION not on PyPI, will publish"
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
- name: Publish to PyPI
|
|
80
|
+
if: steps.check.outputs.exists == 'false'
|
|
81
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
82
|
+
|
|
83
|
+
- name: Create git tag
|
|
84
|
+
if: steps.check.outputs.exists == 'false'
|
|
85
|
+
run: |
|
|
86
|
+
VERSION=${{ steps.check.outputs.version }}
|
|
87
|
+
git config user.name github-actions
|
|
88
|
+
git config user.email github-actions@github.com
|
|
89
|
+
git tag -a "v$VERSION" -m "Release v$VERSION"
|
|
90
|
+
git push origin "v$VERSION"
|
|
@@ -18,15 +18,3 @@ repos:
|
|
|
18
18
|
args: [--fix]
|
|
19
19
|
- id: ruff-format
|
|
20
20
|
|
|
21
|
-
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
22
|
-
rev: v1.11.0
|
|
23
|
-
hooks:
|
|
24
|
-
- id: mypy
|
|
25
|
-
args: [--strict]
|
|
26
|
-
additional_dependencies:
|
|
27
|
-
- pydantic>=2.5.0
|
|
28
|
-
- httpx>=0.27.0
|
|
29
|
-
- types-xmltodict>=0.13.0
|
|
30
|
-
- python-dotenv>=1.0.0
|
|
31
|
-
- tldextract>=5.0.0
|
|
32
|
-
files: ^src/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: namecheap-python
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: A friendly Python SDK for Namecheap API
|
|
5
5
|
Project-URL: Homepage, https://github.com/adriangalilea/namecheap-python
|
|
6
6
|
Project-URL: Repository, https://github.com/adriangalilea/namecheap-python
|
|
@@ -26,21 +26,17 @@ Requires-Dist: tldextract>=5.0.0
|
|
|
26
26
|
Requires-Dist: xmltodict>=0.13.0
|
|
27
27
|
Provides-Extra: all
|
|
28
28
|
Requires-Dist: click>=8.1.0; extra == 'all'
|
|
29
|
+
Requires-Dist: platformdirs>=4.0.0; extra == 'all'
|
|
29
30
|
Requires-Dist: pyyaml>=6.0.0; extra == 'all'
|
|
30
31
|
Requires-Dist: rich>=13.0.0; extra == 'all'
|
|
31
32
|
Requires-Dist: textual>=0.47.0; extra == 'all'
|
|
32
33
|
Provides-Extra: cli
|
|
33
34
|
Requires-Dist: click>=8.1.0; extra == 'cli'
|
|
35
|
+
Requires-Dist: platformdirs>=4.0.0; extra == 'cli'
|
|
34
36
|
Requires-Dist: pyyaml>=6.0.0; extra == 'cli'
|
|
35
37
|
Requires-Dist: rich>=13.0.0; extra == 'cli'
|
|
36
38
|
Provides-Extra: dev
|
|
37
|
-
Requires-Dist: mypy>=1.11.0; extra == 'dev'
|
|
38
|
-
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
39
|
-
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
40
|
-
Requires-Dist: pytest-httpx>=0.30.0; extra == 'dev'
|
|
41
|
-
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
42
39
|
Requires-Dist: ruff>=0.7.0; extra == 'dev'
|
|
43
|
-
Requires-Dist: types-xmltodict>=0.13.0; extra == 'dev'
|
|
44
40
|
Provides-Extra: tui
|
|
45
41
|
Requires-Dist: textual>=0.47.0; extra == 'tui'
|
|
46
42
|
Description-Content-Type: text/markdown
|
|
@@ -60,26 +56,17 @@ A modern, friendly Python SDK for the Namecheap API with comprehensive CLI and T
|
|
|
60
56
|
- **Comprehensive logging** with beautiful colored output
|
|
61
57
|
- **Sandbox support** for safe testing
|
|
62
58
|
|
|
63
|
-
##
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
# Core SDK only
|
|
67
|
-
pip install namecheap-python
|
|
59
|
+
## 🎯 Quick Start
|
|
68
60
|
|
|
69
|
-
|
|
70
|
-
pip install namecheap-python[cli]
|
|
61
|
+
**Requires Python 3.12 or higher**
|
|
71
62
|
|
|
72
|
-
|
|
73
|
-
pip install namecheap-python[tui]
|
|
63
|
+
### `namecheap-python`: Core Python SDK Library
|
|
74
64
|
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
```bash
|
|
66
|
+
# Add as a dependency to your project
|
|
67
|
+
uv add namecheap-python
|
|
77
68
|
```
|
|
78
69
|
|
|
79
|
-
## 🎯 Quick Start
|
|
80
|
-
|
|
81
|
-
### SDK Usage
|
|
82
|
-
|
|
83
70
|
```python
|
|
84
71
|
from namecheap import Namecheap
|
|
85
72
|
|
|
@@ -107,18 +94,22 @@ nc.dns.set("example.com",
|
|
|
107
94
|
)
|
|
108
95
|
```
|
|
109
96
|
|
|
110
|
-
### CLI
|
|
97
|
+
### `namecheap-cli`: CLI tool
|
|
111
98
|
|
|
112
|
-
|
|
113
|
-
# Configure CLI
|
|
114
|
-
uv run namecheap-cli config init
|
|
99
|
+
It was meant as a proof of concept to showcase `namecheap-python`, but it is a tool that I use
|
|
115
100
|
|
|
101
|
+
```bash
|
|
116
102
|
# List domains with beautiful table output
|
|
117
|
-
uv run namecheap-cli domain list
|
|
118
|
-
```
|
|
119
103
|
|
|
120
|
-
|
|
121
|
-
|
|
104
|
+
# Run it without install with:
|
|
105
|
+
uvx --from 'namecheap-python[cli]' namecheap-cli domain list
|
|
106
|
+
|
|
107
|
+
# Or install it permanently with:
|
|
108
|
+
uv tool install --python 3.12 'namecheap-python[cli]'
|
|
109
|
+
|
|
110
|
+
# Then run
|
|
111
|
+
namecheap-cli domain list
|
|
112
|
+
|
|
122
113
|
Domains (4 total)
|
|
123
114
|
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━┓
|
|
124
115
|
┃ Domain ┃ Status ┃ Expires ┃ Auto-Renew ┃ Locked ┃
|
|
@@ -130,22 +121,42 @@ Output:
|
|
|
130
121
|
└───────────────────┴────────┴────────────┴────────────┴────────┘
|
|
131
122
|
```
|
|
132
123
|
|
|
124
|
+
Configure it before first use:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Interactive setup
|
|
128
|
+
namecheap-cli config init
|
|
129
|
+
|
|
130
|
+
# Creates config file at:
|
|
131
|
+
# - Linux/macOS: $XDG_CONFIG_HOME/namecheap/config.yaml (or ~/.config/namecheap/config.yaml)
|
|
132
|
+
# - Windows: %APPDATA%\namecheap\config.yaml
|
|
133
|
+
```
|
|
134
|
+
Check domain availability and pricing:
|
|
135
|
+
|
|
133
136
|
```bash
|
|
134
137
|
# Check domain availability
|
|
135
|
-
|
|
138
|
+
❯ namecheap-cli domain check myawesome.com coolstartup.io
|
|
139
|
+
Domain Availability
|
|
140
|
+
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
|
|
141
|
+
┃ Domain ┃ Available ┃ Price (USD/year) ┃
|
|
142
|
+
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
|
|
143
|
+
│ myawesome.com │ ❌ Taken │ - │
|
|
144
|
+
│ coolstartup.io │ ✅ Available │ $34.98 │
|
|
145
|
+
└────────────────┴──────────────┴──────────────────┘
|
|
146
|
+
|
|
147
|
+
💡 Suggestions for taken domains:
|
|
148
|
+
• myawesome.com → myawesome.net, myawesome.io, getmyawesome.com
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Manage DNS records:
|
|
136
152
|
|
|
137
|
-
|
|
138
|
-
uv run namecheap-cli dns list example.com
|
|
139
|
-
uv run namecheap-cli dns add example.com A www 192.0.2.1
|
|
140
|
-
uv run namecheap-cli dns export example.com --format yaml
|
|
153
|
+
In this example I'll set up GitHub Pages for my domain `tdo.garden`
|
|
141
154
|
|
|
142
|
-
|
|
155
|
+
```bash
|
|
143
156
|
# First, check current DNS records (before setup)
|
|
144
|
-
|
|
145
|
-
```
|
|
157
|
+
namecheap-cli dns list tdo.garden
|
|
146
158
|
|
|
147
|
-
Initial state (Namecheap default parking page):
|
|
148
|
-
```
|
|
159
|
+
# Initial state (Namecheap default parking page):
|
|
149
160
|
DNS Records for tdo.garden (2 total)
|
|
150
161
|
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓
|
|
151
162
|
┃ Type ┃ Name ┃ Value ┃ TTL ┃ Priority ┃
|
|
@@ -153,40 +164,34 @@ Initial state (Namecheap default parking page):
|
|
|
153
164
|
│ CNAME │ www │ parkingpage.namecheap.com. │ 1800 │ 10 │
|
|
154
165
|
│ URL │ @ │ http://www.tdo.garden/ │ 1800 │ 10 │
|
|
155
166
|
└──────────┴──────────────────────┴────────────────────────────┴──────────┴──────────┘
|
|
156
|
-
```
|
|
157
167
|
|
|
158
|
-
```bash
|
|
159
168
|
# Add GitHub Pages A records for apex domain
|
|
160
|
-
❯
|
|
161
|
-
Built namecheap-python @ file:///Users/adrian/Developer/namecheap-python
|
|
162
|
-
Uninstalled 1 package in 0.77ms
|
|
163
|
-
Installed 1 package in 1ms
|
|
169
|
+
❯ namecheap-cli dns add tdo.garden A @ 185.199.108.153
|
|
164
170
|
Adding A record to tdo.garden...
|
|
165
171
|
✅ Added A record successfully!
|
|
166
172
|
|
|
167
|
-
❯
|
|
173
|
+
❯ namecheap-cli dns add tdo.garden A @ 185.199.109.153
|
|
168
174
|
Adding A record to tdo.garden...
|
|
169
175
|
✅ Added A record successfully!
|
|
170
176
|
|
|
171
|
-
❯
|
|
177
|
+
❯ namecheap-cli dns add tdo.garden A @ 185.199.110.153
|
|
172
178
|
Adding A record to tdo.garden...
|
|
173
179
|
✅ Added A record successfully!
|
|
174
180
|
|
|
175
|
-
❯
|
|
181
|
+
❯ namecheap-cli dns add tdo.garden A @ 185.199.111.153
|
|
176
182
|
Adding A record to tdo.garden...
|
|
177
183
|
✅ Added A record successfully!
|
|
178
184
|
|
|
179
185
|
# Add CNAME for www subdomain
|
|
180
|
-
❯
|
|
186
|
+
❯ namecheap-cli dns add tdo.garden CNAME www adriangalilea.github.io
|
|
181
187
|
Adding CNAME record to tdo.garden...
|
|
182
188
|
✅ Added CNAME record successfully!
|
|
183
189
|
|
|
184
190
|
# Verify the setup
|
|
185
|
-
❯
|
|
186
|
-
```
|
|
191
|
+
❯ namecheap-cli dns list tdo.garden
|
|
187
192
|
|
|
188
|
-
Final state
|
|
189
|
-
```
|
|
193
|
+
# Final state with GitHub Pages + old records still present that you may want to remove:
|
|
194
|
+
```bash
|
|
190
195
|
DNS Records for tdo.garden (7 total)
|
|
191
196
|
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓
|
|
192
197
|
┃ Type ┃ Name ┃ Value ┃ TTL ┃ Priority ┃
|
|
@@ -201,18 +206,27 @@ Final state (with GitHub Pages + old records still present):
|
|
|
201
206
|
└──────────┴──────────────────────┴────────────────────────────┴──────────┴──────────┘
|
|
202
207
|
```
|
|
203
208
|
|
|
204
|
-
Note: You may want to remove the old parking page records after confirming GitHub Pages works.
|
|
205
|
-
```
|
|
206
209
|
|
|
207
|
-
|
|
210
|
+
You can also export DNS records:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
namecheap-cli dns export example.com --format yaml
|
|
214
|
+
```
|
|
215
|
+
### `namecheap-dns-tui`: TUI for DNS management
|
|
208
216
|
|
|
209
217
|
```bash
|
|
210
218
|
# Launch interactive DNS manager
|
|
211
|
-
|
|
219
|
+
namecheap-dns-tui
|
|
212
220
|
```
|
|
213
221
|
|
|
214
222
|

|
|
215
223
|
|
|
224
|
+
## Install both the CLI and TUI
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
uv tool install --python 3.12 'namecheap-python[all]'
|
|
228
|
+
```
|
|
229
|
+
|
|
216
230
|
## 📖 Documentation
|
|
217
231
|
|
|
218
232
|
- **[Examples Overview](examples/README.md)** - Quick examples for all tools
|
|
@@ -251,15 +265,6 @@ nc = Namecheap(
|
|
|
251
265
|
)
|
|
252
266
|
```
|
|
253
267
|
|
|
254
|
-
### CLI Configuration
|
|
255
|
-
|
|
256
|
-
```bash
|
|
257
|
-
# Interactive setup
|
|
258
|
-
uv run namecheap-cli config init
|
|
259
|
-
|
|
260
|
-
# Creates ~/.namecheap/config.yaml with profiles
|
|
261
|
-
```
|
|
262
|
-
|
|
263
268
|
## 🔧 Advanced SDK Usage
|
|
264
269
|
|
|
265
270
|
### DNS Builder Pattern
|
|
@@ -376,4 +381,4 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
376
381
|
|
|
377
382
|
## 🤝 Contributing
|
|
378
383
|
|
|
379
|
-
Contributions are welcome! Please feel free to submit a Pull Request. See the [Development Guide](docs/dev/README.md) for setup instructions and guidelines.
|
|
384
|
+
Contributions are welcome! Please feel free to submit a Pull Request. See the [Development Guide](docs/dev/README.md) for setup instructions and guidelines.
|
|
@@ -13,26 +13,17 @@ A modern, friendly Python SDK for the Namecheap API with comprehensive CLI and T
|
|
|
13
13
|
- **Comprehensive logging** with beautiful colored output
|
|
14
14
|
- **Sandbox support** for safe testing
|
|
15
15
|
|
|
16
|
-
##
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
# Core SDK only
|
|
20
|
-
pip install namecheap-python
|
|
16
|
+
## 🎯 Quick Start
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
pip install namecheap-python[cli]
|
|
18
|
+
**Requires Python 3.12 or higher**
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
pip install namecheap-python[tui]
|
|
20
|
+
### `namecheap-python`: Core Python SDK Library
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
```bash
|
|
23
|
+
# Add as a dependency to your project
|
|
24
|
+
uv add namecheap-python
|
|
30
25
|
```
|
|
31
26
|
|
|
32
|
-
## 🎯 Quick Start
|
|
33
|
-
|
|
34
|
-
### SDK Usage
|
|
35
|
-
|
|
36
27
|
```python
|
|
37
28
|
from namecheap import Namecheap
|
|
38
29
|
|
|
@@ -60,18 +51,22 @@ nc.dns.set("example.com",
|
|
|
60
51
|
)
|
|
61
52
|
```
|
|
62
53
|
|
|
63
|
-
### CLI
|
|
54
|
+
### `namecheap-cli`: CLI tool
|
|
64
55
|
|
|
65
|
-
|
|
66
|
-
# Configure CLI
|
|
67
|
-
uv run namecheap-cli config init
|
|
56
|
+
It was meant as a proof of concept to showcase `namecheap-python`, but it is a tool that I use
|
|
68
57
|
|
|
58
|
+
```bash
|
|
69
59
|
# List domains with beautiful table output
|
|
70
|
-
uv run namecheap-cli domain list
|
|
71
|
-
```
|
|
72
60
|
|
|
73
|
-
|
|
74
|
-
|
|
61
|
+
# Run it without install with:
|
|
62
|
+
uvx --from 'namecheap-python[cli]' namecheap-cli domain list
|
|
63
|
+
|
|
64
|
+
# Or install it permanently with:
|
|
65
|
+
uv tool install --python 3.12 'namecheap-python[cli]'
|
|
66
|
+
|
|
67
|
+
# Then run
|
|
68
|
+
namecheap-cli domain list
|
|
69
|
+
|
|
75
70
|
Domains (4 total)
|
|
76
71
|
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━┓
|
|
77
72
|
┃ Domain ┃ Status ┃ Expires ┃ Auto-Renew ┃ Locked ┃
|
|
@@ -83,22 +78,42 @@ Output:
|
|
|
83
78
|
└───────────────────┴────────┴────────────┴────────────┴────────┘
|
|
84
79
|
```
|
|
85
80
|
|
|
81
|
+
Configure it before first use:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Interactive setup
|
|
85
|
+
namecheap-cli config init
|
|
86
|
+
|
|
87
|
+
# Creates config file at:
|
|
88
|
+
# - Linux/macOS: $XDG_CONFIG_HOME/namecheap/config.yaml (or ~/.config/namecheap/config.yaml)
|
|
89
|
+
# - Windows: %APPDATA%\namecheap\config.yaml
|
|
90
|
+
```
|
|
91
|
+
Check domain availability and pricing:
|
|
92
|
+
|
|
86
93
|
```bash
|
|
87
94
|
# Check domain availability
|
|
88
|
-
|
|
95
|
+
❯ namecheap-cli domain check myawesome.com coolstartup.io
|
|
96
|
+
Domain Availability
|
|
97
|
+
┏━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
|
|
98
|
+
┃ Domain ┃ Available ┃ Price (USD/year) ┃
|
|
99
|
+
┡━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
|
|
100
|
+
│ myawesome.com │ ❌ Taken │ - │
|
|
101
|
+
│ coolstartup.io │ ✅ Available │ $34.98 │
|
|
102
|
+
└────────────────┴──────────────┴──────────────────┘
|
|
103
|
+
|
|
104
|
+
💡 Suggestions for taken domains:
|
|
105
|
+
• myawesome.com → myawesome.net, myawesome.io, getmyawesome.com
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Manage DNS records:
|
|
89
109
|
|
|
90
|
-
|
|
91
|
-
uv run namecheap-cli dns list example.com
|
|
92
|
-
uv run namecheap-cli dns add example.com A www 192.0.2.1
|
|
93
|
-
uv run namecheap-cli dns export example.com --format yaml
|
|
110
|
+
In this example I'll set up GitHub Pages for my domain `tdo.garden`
|
|
94
111
|
|
|
95
|
-
|
|
112
|
+
```bash
|
|
96
113
|
# First, check current DNS records (before setup)
|
|
97
|
-
|
|
98
|
-
```
|
|
114
|
+
namecheap-cli dns list tdo.garden
|
|
99
115
|
|
|
100
|
-
Initial state (Namecheap default parking page):
|
|
101
|
-
```
|
|
116
|
+
# Initial state (Namecheap default parking page):
|
|
102
117
|
DNS Records for tdo.garden (2 total)
|
|
103
118
|
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓
|
|
104
119
|
┃ Type ┃ Name ┃ Value ┃ TTL ┃ Priority ┃
|
|
@@ -106,40 +121,34 @@ Initial state (Namecheap default parking page):
|
|
|
106
121
|
│ CNAME │ www │ parkingpage.namecheap.com. │ 1800 │ 10 │
|
|
107
122
|
│ URL │ @ │ http://www.tdo.garden/ │ 1800 │ 10 │
|
|
108
123
|
└──────────┴──────────────────────┴────────────────────────────┴──────────┴──────────┘
|
|
109
|
-
```
|
|
110
124
|
|
|
111
|
-
```bash
|
|
112
125
|
# Add GitHub Pages A records for apex domain
|
|
113
|
-
❯
|
|
114
|
-
Built namecheap-python @ file:///Users/adrian/Developer/namecheap-python
|
|
115
|
-
Uninstalled 1 package in 0.77ms
|
|
116
|
-
Installed 1 package in 1ms
|
|
126
|
+
❯ namecheap-cli dns add tdo.garden A @ 185.199.108.153
|
|
117
127
|
Adding A record to tdo.garden...
|
|
118
128
|
✅ Added A record successfully!
|
|
119
129
|
|
|
120
|
-
❯
|
|
130
|
+
❯ namecheap-cli dns add tdo.garden A @ 185.199.109.153
|
|
121
131
|
Adding A record to tdo.garden...
|
|
122
132
|
✅ Added A record successfully!
|
|
123
133
|
|
|
124
|
-
❯
|
|
134
|
+
❯ namecheap-cli dns add tdo.garden A @ 185.199.110.153
|
|
125
135
|
Adding A record to tdo.garden...
|
|
126
136
|
✅ Added A record successfully!
|
|
127
137
|
|
|
128
|
-
❯
|
|
138
|
+
❯ namecheap-cli dns add tdo.garden A @ 185.199.111.153
|
|
129
139
|
Adding A record to tdo.garden...
|
|
130
140
|
✅ Added A record successfully!
|
|
131
141
|
|
|
132
142
|
# Add CNAME for www subdomain
|
|
133
|
-
❯
|
|
143
|
+
❯ namecheap-cli dns add tdo.garden CNAME www adriangalilea.github.io
|
|
134
144
|
Adding CNAME record to tdo.garden...
|
|
135
145
|
✅ Added CNAME record successfully!
|
|
136
146
|
|
|
137
147
|
# Verify the setup
|
|
138
|
-
❯
|
|
139
|
-
```
|
|
148
|
+
❯ namecheap-cli dns list tdo.garden
|
|
140
149
|
|
|
141
|
-
Final state
|
|
142
|
-
```
|
|
150
|
+
# Final state with GitHub Pages + old records still present that you may want to remove:
|
|
151
|
+
```bash
|
|
143
152
|
DNS Records for tdo.garden (7 total)
|
|
144
153
|
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━┓
|
|
145
154
|
┃ Type ┃ Name ┃ Value ┃ TTL ┃ Priority ┃
|
|
@@ -154,18 +163,27 @@ Final state (with GitHub Pages + old records still present):
|
|
|
154
163
|
└──────────┴──────────────────────┴────────────────────────────┴──────────┴──────────┘
|
|
155
164
|
```
|
|
156
165
|
|
|
157
|
-
Note: You may want to remove the old parking page records after confirming GitHub Pages works.
|
|
158
|
-
```
|
|
159
166
|
|
|
160
|
-
|
|
167
|
+
You can also export DNS records:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
namecheap-cli dns export example.com --format yaml
|
|
171
|
+
```
|
|
172
|
+
### `namecheap-dns-tui`: TUI for DNS management
|
|
161
173
|
|
|
162
174
|
```bash
|
|
163
175
|
# Launch interactive DNS manager
|
|
164
|
-
|
|
176
|
+
namecheap-dns-tui
|
|
165
177
|
```
|
|
166
178
|
|
|
167
179
|

|
|
168
180
|
|
|
181
|
+
## Install both the CLI and TUI
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
uv tool install --python 3.12 'namecheap-python[all]'
|
|
185
|
+
```
|
|
186
|
+
|
|
169
187
|
## 📖 Documentation
|
|
170
188
|
|
|
171
189
|
- **[Examples Overview](examples/README.md)** - Quick examples for all tools
|
|
@@ -204,15 +222,6 @@ nc = Namecheap(
|
|
|
204
222
|
)
|
|
205
223
|
```
|
|
206
224
|
|
|
207
|
-
### CLI Configuration
|
|
208
|
-
|
|
209
|
-
```bash
|
|
210
|
-
# Interactive setup
|
|
211
|
-
uv run namecheap-cli config init
|
|
212
|
-
|
|
213
|
-
# Creates ~/.namecheap/config.yaml with profiles
|
|
214
|
-
```
|
|
215
|
-
|
|
216
225
|
## 🔧 Advanced SDK Usage
|
|
217
226
|
|
|
218
227
|
### DNS Builder Pattern
|
|
@@ -329,4 +338,4 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
329
338
|
|
|
330
339
|
## 🤝 Contributing
|
|
331
340
|
|
|
332
|
-
Contributions are welcome! Please feel free to submit a Pull Request. See the [Development Guide](docs/dev/README.md) for setup instructions and guidelines.
|
|
341
|
+
Contributions are welcome! Please feel free to submit a Pull Request. See the [Development Guide](docs/dev/README.md) for setup instructions and guidelines.
|
|
@@ -47,7 +47,9 @@ print("🌐 DNS Management example:")
|
|
|
47
47
|
try:
|
|
48
48
|
# Get current DNS records for a domain
|
|
49
49
|
# Use the first domain from your account, or specify one
|
|
50
|
-
domain_name =
|
|
50
|
+
domain_name = (
|
|
51
|
+
my_domains[0].name if my_domains else "example.com"
|
|
52
|
+
) # Replace with your domain
|
|
51
53
|
print(f"Current DNS records for {domain_name}:")
|
|
52
54
|
|
|
53
55
|
records = nc.dns.get(domain_name)
|