Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
Python Namecheap API wrapper for simple domain name registration and management.
NOTE: you will need API key from Namecheap to use this module (see below).
This is work in progress. Official API docs: https://www.namecheap.com/support/api
For now I'm trying not to use anything outside the standard library. Most methods are more or less well-documented, so don't be shy to use help(). Type hints (PEP 484) are available for every method. Method names are NOT in 100% match with those from Namecheap, but they are more pythonic and/or hopefully make more sense.
... and more.
Namecheap offers two API endpoints: sandbox (for development & testing) and production (for real world). You can sign up for a free sandbox account at https://www.sandbox.namecheap.com/ and activate API access at https://ap.www.sandbox.namecheap.com/Profile/Tools/ApiAccess
Make sure to add your public IP address in Whitelisted IPs section.
Keep in mind that sandbox domains are not 'real', i.e. they exist only in Namecheap sandbox (not on the actual Web). With that you may be able to see google.com as available for registration. At the same time, you will need to make sure to register your 'virtual' domains if you want to test domain-specific options, such as renewal, DNS updates, etc.
::
$ pip install namecheapapi
.. code-block:: python
# Initialize API
>>> from namecheapapi import DomainAPI
>>> api = DomainAPI(
... api_user='api_user',
... api_key='api_key,
... username='username', # usually the same as api_user
... client_ip='your IP address',
... sandbox=True, # recommended for testing
... coupon='coupon' # optional
...)
>>>
# Check availability of google.com
>>> api.check('google.com')
{'google.com': False}
# Check multiple domains at once
>>> api.check(['asdfghjhgfdsa.com', 'google.com'])
{'google.com': False, 'asdfghjhgfdsa.com': True}
# Register a domain
>>> address = {
... 'FirstName': 'Peter',
... 'LastName': 'Griffin',
... 'Address1': '31 Spooner St.',
... 'City': 'Quahog',
... 'StateProvince': 'RI',
... 'PostalCode': '00093',
... 'Country': 'US',
... 'Phone': '+1.123456789',
... 'EmailAddress': 'peter@griffin.tv'
...}
>>> api.register('asdfghjhgfdsa.com', address=address)
{'NonRealTimeDomain': False, 'TransactionID': 1216215, 'WhoisGuardEnabled': False, 'Domain': 'asdfghjhgfdsa.com', 'OrderID': 823656, 'Success': True, 'ChargedAmount': 10.87, 'ID': 117154}
# Custom query (a raw XML response is returned)
>>> q = api.raw_query(command='namecheap.domains.transfer.getList', query={})
>>> print(q)
<?xml version="1.0" encoding="utf-8"?>
<ApiResponse Status="OK" xmlns="http://api.namecheap.com/xml.response">
<Errors />
<Warnings />
<RequestedCommand>namecheap.domains.transfer.getlist</RequestedCommand>
<CommandResponse Type="namecheap.domains.transfer.getList">
<TransferGetListResult />
<Paging>
<TotalItems>0</TotalItems>
<CurrentPage>1</CurrentPage>
<PageSize>20</PageSize>
</Paging>
</CommandResponse>
<Server>PHX01SBAPI01</Server>
<GMTTimeDifference>--4:00</GMTTimeDifference>
<ExecutionTime>0.01</ExecutionTime>
</ApiResponse>
(does have one dependency)
pip install nose
)config.py
in namecheapapi/tests/
directory, fill it in:API_KEY
= 'string' -- API key that you got from NamecheapAPI_USER
= 'string' -- your Namecheap usernameUSERNAME
= 'string' -- in most cases it would be your Namecheap usernameCLIENT_IP
= 'string' -- your public IP address (MUST be whitelisted in your Namecheap account)SANDBOX
= True (recommended!)COUPON
= 'string' -- coupon code if you have any, '' otherwiseDOMAIN
= 'string' -- a domain name you ALREADY HAVE in your Namecheap accountnosetests /path/to/namecheapapi/dir
0.2.1
* minor bugfixes
0.2
~~~
* documentation update
* domains.get_contacts/set_contacts methods added
0.1.1
Author
Alex Sanchez <mailto:alex@s1ck.org>
_.
FAQs
Python Namecheap API wrapper
We found that namecheapapi demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.