All Projects → yonjuuni → namecheapapi

yonjuuni / namecheapapi

Licence: MIT License
Python Namecheap API wrapper. Supports domain registration/renewal/management, domain availability checks, DNS updates and more.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to namecheapapi

Bugcrowd Levelup Subdomain Enumeration
This repository contains all the material from the talk "Esoteric sub-domain enumeration techniques" given at Bugcrowd LevelUp 2017 virtual conference
Stars: ✭ 513 (+2231.82%)
Mutual labels:  dns, domains
DNS-Sinkhole-Lists-A2
A DNS Sinkhole List for testing purposes. (not for use in production systems) - UUID: 0f90ca2c-4b0a-4fbe-b659-449ab30c4284
Stars: ✭ 19 (-13.64%)
Mutual labels:  dns, domains
Dnstwist
Domain name permutation engine for detecting homograph phishing attacks, typo squatting, and brand impersonation
Stars: ✭ 3,124 (+14100%)
Mutual labels:  dns, domains
Domainfuzz
Domain name permutation engine for detecting typo squatting, phishing and corporate espionage
Stars: ✭ 74 (+236.36%)
Mutual labels:  dns, domains
1hosts
DNS filter-/blocklists | safe. private. clean. browsing!
Stars: ✭ 85 (+286.36%)
Mutual labels:  dns, domains
Python Whois
Python module/library for retrieving WHOIS information of domains 💻❤
Stars: ✭ 128 (+481.82%)
Mutual labels:  dns, domains
Bass
Bass grabs you those "extra resolvers" you are missing out on when performing Active DNS enumeration. Add anywhere from 100-6k resolvers to your "resolver.txt"
Stars: ✭ 104 (+372.73%)
Mutual labels:  dns, domains
Dnsmorph
Domain name permutation engine written in Go
Stars: ✭ 148 (+572.73%)
Mutual labels:  dns, domains
ssrf-agent
make http(s) request to prevent SSRF
Stars: ✭ 16 (-27.27%)
Mutual labels:  dns
black-mirror
Automatically maintained malicious host blacklists and false-positive whitelists.
Stars: ✭ 41 (+86.36%)
Mutual labels:  dns
Dns
The Hoa\Dns library.
Stars: ✭ 22 (+0%)
Mutual labels:  dns
Windows.10.DNS.Block.List
Windows DNS Block List
Stars: ✭ 18 (-18.18%)
Mutual labels:  dns
RESTKnot
REST API for Knot Service
Stars: ✭ 15 (-31.82%)
Mutual labels:  dns
powerdns-php
PowerDNS API PHP Client
Stars: ✭ 67 (+204.55%)
Mutual labels:  dns
AdGuard-WireGuard-Unbound-Cloudflare
The Ultimate Network Security Guide 🔒 Protection | 🔎 Privacy | 🚀 Performance on home network 24/7 🕛 Accessible anywhere 🌏
Stars: ✭ 160 (+627.27%)
Mutual labels:  dns
fresh.py
An efficient multi-threaded DNS resolver validator
Stars: ✭ 80 (+263.64%)
Mutual labels:  dns
Alfis
Alternative Free Identity System
Stars: ✭ 162 (+636.36%)
Mutual labels:  dns
ebook
Third edition of the Computer Networking: Principles, Protocols and Practice ebook
Stars: ✭ 64 (+190.91%)
Mutual labels:  dns
flareon
🦊A cloudflare DNS over HTTPs resolver client library.
Stars: ✭ 14 (-36.36%)
Mutual labels:  dns
python-dyndnsc
dynamic dns (dyndns) update client with support for multiple protocols
Stars: ✭ 36 (+63.64%)
Mutual labels:  dns

namecheapapi

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).

Overview

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.

Features

  • domain registration/renewal
  • domain availability check
  • DNS updates
  • WHOIS information updates
  • get your domain's information
  • get a list of your Namecheap domains
  • set/remove registrar lock

... and more.

Namecheap API

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.

Installation

$ pip install namecheapapi

Example usage

# 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': '[email protected]'
...}
>>> 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>

Implemented methods

  • domains.register (namecheap.domains.create)
  • domains.check (namecheap.domains.check)
  • domains.get_info (namecheap.domains.getInfo)
  • domains.get_list (namecheap.domains.getList)
  • domains.get_tld_list (namecheap.domains.getTldList)
  • domains.renew (namecheap.domains.renew)
  • domains.reactivate (namecheap.domains.reactivate)
  • domains.get_lock (namecheap.domains.getRegistrarLock)
  • domains.set_lock (namecheap.domains.setRegistrarLock)
  • domains.get_nameservers (namecheap.domains.dns.getList)
  • domains.set_nameservers (namecheap.domains.dns.setCustom, namecheap.domains.dns.setDefault)
  • domains.get_contacts (namecheap.domains.getContacts)
  • domains.set_contacts (namecheap.domains.setContacts)

TODO

  • domains.create_nameserver (namecheap.domains.ns.create)
  • domains.delete_nameserver (namecheap.domains.ns.delete)
  • domains.update_nameserver (namecheap.domains.ns.update)
  • domains.get_nameserver_info (namecheap.domains.ns.getInfo)
  • domains.get_host_records (namecheap.domains.dns.getHosts)
  • domains.set_host_records (namecheap.domains.dns.setHosts)

Testing

  1. Create config.py in namecheapapi/tests/ directory, fill it in:
  • API_KEY = 'string' -- API key that you got from Namecheap
  • API_USER = 'string' -- your Namecheap username
  • USERNAME = 'string' -- in most cases it would be your Namecheap username
  • CLIENT_IP = 'string' -- your public IP address (MUST be whitelisted in your Namecheap account)
  • SANDBOX = True (recommended!)
  • COUPON = 'string' -- coupon code if you have any, '' otherwise
  • DOMAIN = 'string' -- a domain name you ALREADY HAVE in your Namecheap account
  1. Run python3 -m unittest -v /path/to/namecheapapi/dir

Changelog

0.2.1

  • minor bugfixes

0.2

  • documentation update
  • domains.get_contacts/set_contacts methods added

0.1.1

  • First published working version.

Author

Alex Sanchez.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].