namecheap-python 0.1.5__tar.gz → 0.2.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.
- {namecheap_python-0.1.5 → namecheap_python-0.2.0}/PKG-INFO +78 -21
- {namecheap_python-0.1.5 → namecheap_python-0.2.0}/README.md +77 -20
- {namecheap_python-0.1.5 → namecheap_python-0.2.0}/namecheap/__init__.py +4 -12
- namecheap_python-0.2.0/namecheap/api/__init__.py +10 -0
- namecheap_python-0.2.0/namecheap/api/domains/__init__.py +30 -0
- namecheap_python-0.2.0/namecheap/api/domains/base.py +715 -0
- namecheap_python-0.2.0/namecheap/api/domains/dns.py +745 -0
- namecheap_python-0.2.0/namecheap/api/domains/ns.py +468 -0
- namecheap_python-0.2.0/namecheap/api/domains/transfer.py +277 -0
- namecheap_python-0.2.0/namecheap/api/map.md +71 -0
- namecheap_python-0.2.0/namecheap/api/ssl/__init__.py +7 -0
- namecheap_python-0.2.0/namecheap/api/ssl/base.py +338 -0
- namecheap_python-0.2.0/namecheap/api/users/__init__.py +7 -0
- namecheap_python-0.2.0/namecheap/api/users/base.py +345 -0
- namecheap_python-0.2.0/namecheap/base.py +771 -0
- namecheap_python-0.2.0/namecheap/client.py +71 -0
- namecheap_python-0.2.0/namecheap/enhanced/__init__.py +8 -0
- namecheap_python-0.2.0/namecheap/enhanced/dns.py +371 -0
- namecheap_python-0.2.0/namecheap/enhanced/domains.py +445 -0
- namecheap_python-0.2.0/namecheap/exceptions.py +117 -0
- {namecheap_python-0.1.5 → namecheap_python-0.2.0}/namecheap/utils.py +92 -5
- {namecheap_python-0.1.5 → namecheap_python-0.2.0}/pyproject.toml +3 -2
- namecheap_python-0.1.5/namecheap/client.py +0 -932
- namecheap_python-0.1.5/namecheap/exceptions.py +0 -41
- {namecheap_python-0.1.5 → namecheap_python-0.2.0}/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: namecheap-python
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: A Python SDK for the Namecheap API
|
|
5
5
|
License: MIT
|
|
6
6
|
Keywords: namecheap,domain,dns,api,sdk
|
|
@@ -130,19 +130,45 @@ client = NamecheapClient(
|
|
|
130
130
|
client = NamecheapClient() # Automatically loads credentials from environment
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
+
### Client Structure
|
|
134
|
+
|
|
135
|
+
The SDK provides two ways to interact with the Namecheap API:
|
|
136
|
+
|
|
137
|
+
1. **Direct API mapping**: Access the API endpoints directly using the same structure as the Namecheap API documentation.
|
|
138
|
+
```python
|
|
139
|
+
# Direct API mapping - matches the Namecheap API documentation
|
|
140
|
+
result = client.domains.check(["example.com", "example.net"])
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
2. **Enhanced functionality**: Access enhanced methods that combine multiple API calls and provide additional features.
|
|
144
|
+
```python
|
|
145
|
+
# Enhanced functionality with improved data structure
|
|
146
|
+
result = client.enhanced.domains.check_with_pricing(["example.com", "example.net"])
|
|
147
|
+
```
|
|
148
|
+
|
|
133
149
|
### Check Domain Availability
|
|
134
150
|
|
|
135
151
|
```python
|
|
136
152
|
try:
|
|
137
|
-
# Check multiple domains at once (up to 50)
|
|
153
|
+
# Standard API - Check multiple domains at once (up to 50)
|
|
138
154
|
domains_to_check = ["example.com", "example.net", "example.org"]
|
|
139
|
-
result = client.
|
|
155
|
+
result = client.domains.check(domains_to_check)
|
|
140
156
|
|
|
141
157
|
# Process results
|
|
142
158
|
for domain in result.get("DomainCheckResult", []):
|
|
143
159
|
print(f"{domain['Domain']}: {'Available' if domain['Available'] else 'Not available'}")
|
|
144
160
|
if domain['IsPremiumName']:
|
|
145
161
|
print(f" Premium Domain - Price: {domain['PremiumRegistrationPrice']}")
|
|
162
|
+
|
|
163
|
+
# Enhanced API - Check with comprehensive pricing information
|
|
164
|
+
result = client.enhanced.domains.check_with_pricing(domains_to_check)
|
|
165
|
+
|
|
166
|
+
for domain in result.get("DomainCheckResult", []):
|
|
167
|
+
if domain['Available']:
|
|
168
|
+
print(f"{domain['Domain']}: Available - Price: ${domain['Price']:.2f}")
|
|
169
|
+
else:
|
|
170
|
+
print(f"{domain['Domain']}: Not available")
|
|
171
|
+
|
|
146
172
|
except NamecheapException as e:
|
|
147
173
|
print(f"API Error: {e}")
|
|
148
174
|
```
|
|
@@ -152,14 +178,12 @@ except NamecheapException as e:
|
|
|
152
178
|
Running the check_domain.py example produces output like the following:
|
|
153
179
|
|
|
154
180
|
```
|
|
155
|
-
Checking availability for: example.com, something123unique.com
|
|
156
|
-
|
|
157
181
|
Results:
|
|
158
182
|
------------------------------------------------------------
|
|
159
183
|
Domain Available Premium Price
|
|
160
184
|
------------------------------------------------------------
|
|
161
185
|
example.com No No N/A
|
|
162
|
-
something123unique.com Yes No
|
|
186
|
+
something123unique.com Yes No $11.28
|
|
163
187
|
```
|
|
164
188
|
|
|
165
189
|
### List Your Domains
|
|
@@ -301,20 +325,43 @@ Namecheap API has the following rate limits:
|
|
|
301
325
|
|
|
302
326
|
The SDK currently supports the following Namecheap API endpoints:
|
|
303
327
|
|
|
304
|
-
###
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
- `
|
|
308
|
-
- `
|
|
309
|
-
- `
|
|
310
|
-
- `
|
|
311
|
-
- `
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
- `
|
|
317
|
-
- `
|
|
328
|
+
### Standard API
|
|
329
|
+
|
|
330
|
+
#### Domains
|
|
331
|
+
- `domains.check` - Check domain availability
|
|
332
|
+
- `domains.get_list` - Get list of domains in your account
|
|
333
|
+
- `domains.get_contacts` - Get contact information for a domain
|
|
334
|
+
- `domains.create` - Register a new domain
|
|
335
|
+
- `domains.renew` - Renew a domain
|
|
336
|
+
- `domains.get_info` - Get detailed information about a domain
|
|
337
|
+
- `domains.get_tld_list` - Get list of available TLDs
|
|
338
|
+
|
|
339
|
+
#### DNS
|
|
340
|
+
- `domains.dns.set_custom` - Set custom nameservers for a domain
|
|
341
|
+
- `domains.dns.set_default` - Set default nameservers for a domain
|
|
342
|
+
- `domains.dns.get_hosts` - Get DNS host records for a domain
|
|
343
|
+
- `domains.dns.set_hosts` - Set DNS host records for a domain
|
|
344
|
+
|
|
345
|
+
#### Users
|
|
346
|
+
- `users.get_pricing` - Get pricing information for Namecheap products
|
|
347
|
+
- `users.get_balances` - Get account balances
|
|
348
|
+
|
|
349
|
+
#### SSL
|
|
350
|
+
- `ssl.activate` - Activate an SSL certificate
|
|
351
|
+
- `ssl.get_list` - Get list of SSL certificates
|
|
352
|
+
- `ssl.create` - Purchase an SSL certificate
|
|
353
|
+
- `ssl.get_info` - Get information about an SSL certificate
|
|
354
|
+
|
|
355
|
+
### Enhanced API
|
|
356
|
+
|
|
357
|
+
The SDK also provides enhanced functionality that combines multiple API calls:
|
|
358
|
+
|
|
359
|
+
#### Domains
|
|
360
|
+
- `enhanced.domains.check_with_pricing` - Check domain availability with comprehensive pricing information
|
|
361
|
+
- `enhanced.domains.search_available` - Search for available domains based on a keyword
|
|
362
|
+
|
|
363
|
+
#### DNS
|
|
364
|
+
- `enhanced.dns.update_records` - Update specific DNS records without affecting others
|
|
318
365
|
|
|
319
366
|
Additional endpoints from the Namecheap API may be added in future releases based on user needs and contributions.
|
|
320
367
|
|
|
@@ -398,6 +445,16 @@ This project uses an automated release workflow for versioning and publishing to
|
|
|
398
445
|
- `major`: for backwards incompatible changes (0.2.0 -> 1.0.0)
|
|
399
446
|
6. Click "Run workflow" to start the process
|
|
400
447
|
|
|
448
|
+
Alternatively, you can use the GitHub CLI to bump the version directly from your terminal:
|
|
449
|
+
|
|
450
|
+
```bash
|
|
451
|
+
# Using GitHub CLI directly
|
|
452
|
+
gh workflow run "Bump Version and Release" -f release-type=patch|minor|major
|
|
453
|
+
|
|
454
|
+
# Or using the provided utility script
|
|
455
|
+
python utils/bump-version.py patch|minor|major
|
|
456
|
+
```
|
|
457
|
+
|
|
401
458
|
### What Happens Automatically
|
|
402
459
|
|
|
403
460
|
The workflow will:
|
|
@@ -415,7 +472,7 @@ This project is licensed under the MIT License - see the LICENSE file for detail
|
|
|
415
472
|
|
|
416
473
|
## Disclaimer
|
|
417
474
|
|
|
418
|
-
All this code was produced in a single
|
|
475
|
+
All this code was produced in a single vibe coding session with `claude code` for 2 hours and ~$30.
|
|
419
476
|
|
|
420
477
|
Excuse the occasional AI slop, if you spot it let me know.
|
|
421
478
|
|
|
@@ -101,19 +101,45 @@ client = NamecheapClient(
|
|
|
101
101
|
client = NamecheapClient() # Automatically loads credentials from environment
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
### Client Structure
|
|
105
|
+
|
|
106
|
+
The SDK provides two ways to interact with the Namecheap API:
|
|
107
|
+
|
|
108
|
+
1. **Direct API mapping**: Access the API endpoints directly using the same structure as the Namecheap API documentation.
|
|
109
|
+
```python
|
|
110
|
+
# Direct API mapping - matches the Namecheap API documentation
|
|
111
|
+
result = client.domains.check(["example.com", "example.net"])
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
2. **Enhanced functionality**: Access enhanced methods that combine multiple API calls and provide additional features.
|
|
115
|
+
```python
|
|
116
|
+
# Enhanced functionality with improved data structure
|
|
117
|
+
result = client.enhanced.domains.check_with_pricing(["example.com", "example.net"])
|
|
118
|
+
```
|
|
119
|
+
|
|
104
120
|
### Check Domain Availability
|
|
105
121
|
|
|
106
122
|
```python
|
|
107
123
|
try:
|
|
108
|
-
# Check multiple domains at once (up to 50)
|
|
124
|
+
# Standard API - Check multiple domains at once (up to 50)
|
|
109
125
|
domains_to_check = ["example.com", "example.net", "example.org"]
|
|
110
|
-
result = client.
|
|
126
|
+
result = client.domains.check(domains_to_check)
|
|
111
127
|
|
|
112
128
|
# Process results
|
|
113
129
|
for domain in result.get("DomainCheckResult", []):
|
|
114
130
|
print(f"{domain['Domain']}: {'Available' if domain['Available'] else 'Not available'}")
|
|
115
131
|
if domain['IsPremiumName']:
|
|
116
132
|
print(f" Premium Domain - Price: {domain['PremiumRegistrationPrice']}")
|
|
133
|
+
|
|
134
|
+
# Enhanced API - Check with comprehensive pricing information
|
|
135
|
+
result = client.enhanced.domains.check_with_pricing(domains_to_check)
|
|
136
|
+
|
|
137
|
+
for domain in result.get("DomainCheckResult", []):
|
|
138
|
+
if domain['Available']:
|
|
139
|
+
print(f"{domain['Domain']}: Available - Price: ${domain['Price']:.2f}")
|
|
140
|
+
else:
|
|
141
|
+
print(f"{domain['Domain']}: Not available")
|
|
142
|
+
|
|
117
143
|
except NamecheapException as e:
|
|
118
144
|
print(f"API Error: {e}")
|
|
119
145
|
```
|
|
@@ -123,14 +149,12 @@ except NamecheapException as e:
|
|
|
123
149
|
Running the check_domain.py example produces output like the following:
|
|
124
150
|
|
|
125
151
|
```
|
|
126
|
-
Checking availability for: example.com, something123unique.com
|
|
127
|
-
|
|
128
152
|
Results:
|
|
129
153
|
------------------------------------------------------------
|
|
130
154
|
Domain Available Premium Price
|
|
131
155
|
------------------------------------------------------------
|
|
132
156
|
example.com No No N/A
|
|
133
|
-
something123unique.com Yes No
|
|
157
|
+
something123unique.com Yes No $11.28
|
|
134
158
|
```
|
|
135
159
|
|
|
136
160
|
### List Your Domains
|
|
@@ -272,20 +296,43 @@ Namecheap API has the following rate limits:
|
|
|
272
296
|
|
|
273
297
|
The SDK currently supports the following Namecheap API endpoints:
|
|
274
298
|
|
|
275
|
-
###
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
- `
|
|
279
|
-
- `
|
|
280
|
-
- `
|
|
281
|
-
- `
|
|
282
|
-
- `
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
- `
|
|
288
|
-
- `
|
|
299
|
+
### Standard API
|
|
300
|
+
|
|
301
|
+
#### Domains
|
|
302
|
+
- `domains.check` - Check domain availability
|
|
303
|
+
- `domains.get_list` - Get list of domains in your account
|
|
304
|
+
- `domains.get_contacts` - Get contact information for a domain
|
|
305
|
+
- `domains.create` - Register a new domain
|
|
306
|
+
- `domains.renew` - Renew a domain
|
|
307
|
+
- `domains.get_info` - Get detailed information about a domain
|
|
308
|
+
- `domains.get_tld_list` - Get list of available TLDs
|
|
309
|
+
|
|
310
|
+
#### DNS
|
|
311
|
+
- `domains.dns.set_custom` - Set custom nameservers for a domain
|
|
312
|
+
- `domains.dns.set_default` - Set default nameservers for a domain
|
|
313
|
+
- `domains.dns.get_hosts` - Get DNS host records for a domain
|
|
314
|
+
- `domains.dns.set_hosts` - Set DNS host records for a domain
|
|
315
|
+
|
|
316
|
+
#### Users
|
|
317
|
+
- `users.get_pricing` - Get pricing information for Namecheap products
|
|
318
|
+
- `users.get_balances` - Get account balances
|
|
319
|
+
|
|
320
|
+
#### SSL
|
|
321
|
+
- `ssl.activate` - Activate an SSL certificate
|
|
322
|
+
- `ssl.get_list` - Get list of SSL certificates
|
|
323
|
+
- `ssl.create` - Purchase an SSL certificate
|
|
324
|
+
- `ssl.get_info` - Get information about an SSL certificate
|
|
325
|
+
|
|
326
|
+
### Enhanced API
|
|
327
|
+
|
|
328
|
+
The SDK also provides enhanced functionality that combines multiple API calls:
|
|
329
|
+
|
|
330
|
+
#### Domains
|
|
331
|
+
- `enhanced.domains.check_with_pricing` - Check domain availability with comprehensive pricing information
|
|
332
|
+
- `enhanced.domains.search_available` - Search for available domains based on a keyword
|
|
333
|
+
|
|
334
|
+
#### DNS
|
|
335
|
+
- `enhanced.dns.update_records` - Update specific DNS records without affecting others
|
|
289
336
|
|
|
290
337
|
Additional endpoints from the Namecheap API may be added in future releases based on user needs and contributions.
|
|
291
338
|
|
|
@@ -369,6 +416,16 @@ This project uses an automated release workflow for versioning and publishing to
|
|
|
369
416
|
- `major`: for backwards incompatible changes (0.2.0 -> 1.0.0)
|
|
370
417
|
6. Click "Run workflow" to start the process
|
|
371
418
|
|
|
419
|
+
Alternatively, you can use the GitHub CLI to bump the version directly from your terminal:
|
|
420
|
+
|
|
421
|
+
```bash
|
|
422
|
+
# Using GitHub CLI directly
|
|
423
|
+
gh workflow run "Bump Version and Release" -f release-type=patch|minor|major
|
|
424
|
+
|
|
425
|
+
# Or using the provided utility script
|
|
426
|
+
python utils/bump-version.py patch|minor|major
|
|
427
|
+
```
|
|
428
|
+
|
|
372
429
|
### What Happens Automatically
|
|
373
430
|
|
|
374
431
|
The workflow will:
|
|
@@ -386,6 +443,6 @@ This project is licensed under the MIT License - see the LICENSE file for detail
|
|
|
386
443
|
|
|
387
444
|
## Disclaimer
|
|
388
445
|
|
|
389
|
-
All this code was produced in a single
|
|
446
|
+
All this code was produced in a single vibe coding session with `claude code` for 2 hours and ~$30.
|
|
390
447
|
|
|
391
448
|
Excuse the occasional AI slop, if you spot it let me know.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Namecheap Python
|
|
2
|
+
Namecheap API Python client
|
|
3
3
|
|
|
4
4
|
A Python wrapper for interacting with the Namecheap API.
|
|
5
5
|
|
|
@@ -36,17 +36,9 @@ from .utils import (
|
|
|
36
36
|
test_api_connection,
|
|
37
37
|
)
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
__version__ = version("namecheap-python")
|
|
44
|
-
except ImportError:
|
|
45
|
-
# Default version if importlib.metadata is not available (Python < 3.8)
|
|
46
|
-
__version__ = "0.1.2"
|
|
47
|
-
except Exception:
|
|
48
|
-
# If package is not installed or version can't be determined
|
|
49
|
-
__version__ = "0.1.2"
|
|
39
|
+
__version__ = "0.2.0"
|
|
40
|
+
__author__ = "Adrian Galilea"
|
|
41
|
+
|
|
50
42
|
__all__ = [
|
|
51
43
|
"NamecheapClient",
|
|
52
44
|
"NamecheapException",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""
|
|
2
|
+
API module for direct 1:1 mapping to Namecheap API endpoints
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Import all API modules to make them available through the api namespace
|
|
6
|
+
from .domains import DomainsAPI
|
|
7
|
+
from .ssl import SslAPI
|
|
8
|
+
from .users import UsersAPI
|
|
9
|
+
|
|
10
|
+
__all__ = ["DomainsAPI", "UsersAPI", "SslAPI"]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Domains API namespace
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from .base import DomainsBaseAPI
|
|
8
|
+
from .dns import DnsAPI
|
|
9
|
+
from .ns import NsAPI
|
|
10
|
+
from .transfer import TransferAPI
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DomainsAPI(DomainsBaseAPI):
|
|
14
|
+
"""
|
|
15
|
+
Domains API client providing access to all domains-related API endpoints
|
|
16
|
+
|
|
17
|
+
This includes:
|
|
18
|
+
- Basic domain operations (check, getList, etc.)
|
|
19
|
+
- DNS management operations through the dns namespace
|
|
20
|
+
- Nameserver operations through the ns namespace
|
|
21
|
+
- Transfer operations through the transfer namespace
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(self, client: Any) -> None:
|
|
25
|
+
super().__init__(client)
|
|
26
|
+
|
|
27
|
+
# Initialize subnamespaces
|
|
28
|
+
self.dns = DnsAPI(client)
|
|
29
|
+
self.ns = NsAPI(client)
|
|
30
|
+
self.transfer = TransferAPI(client)
|