Python interface for c-ares
Project description
pycares is a Python module which provides an interface to c-ares. c-ares is a C library that performs DNS requests and name resolutions asynchronously.
Documentation
Bundled c-ares
pycares currently bundles c-ares and as of pycares 1.0.0 this is a strong requirement. Upstream c-ares is not willing to apply a patch adding TTL support. I did apply the patch to the bundled c-ares, but unfortunately it breaks the ABI, so attempting to use a system provided c-ares is not possible.
Installation
GNU/Linux, macOS, Windows, others:
pip install pycares
FreeBSD:
cd /usr/ports/dns/py-pycares && make install
IDNA 2008 support
If the idna package is installed, pycares will support IDNA 2008 encodingm otherwise the builtin idna codec will be used, which provides IDNA 2003 support.
You can force this at installation time as follows:
pip install pycares[idna]
Running the test suite
There are several ways of running the test ruite:
Run the test with the current Python interpreter:
From the toplevel directory, run: python tests/tests.py
Use Tox to run the test suite in several virtualenvs with several interpreters
From the toplevel directory, run: tox -e py35,py36,py37 this will run the test suite on Python 3.5, 3.6 and 3.7 (you’ll need to have them installed beforehand)
Using it from the cli, a la dig
This module can be used directly from the command line in a similar fashion to dig (limited, of course):
$ python -m pycares google.com ;; QUESTION SECTION: ;google.com IN A ;; ANSWER SECTION: google.com 300 IN A 172.217.17.142 $ python -m pycares mx google.com ;; QUESTION SECTION: ;google.com IN MX ;; ANSWER SECTION: google.com 600 IN MX 50 alt4.aspmx.l.google.com google.com 600 IN MX 10 aspmx.l.google.com google.com 600 IN MX 40 alt3.aspmx.l.google.com google.com 600 IN MX 20 alt1.aspmx.l.google.com google.com 600 IN MX 30 alt2.aspmx.l.google.com
License
Unless stated otherwise on-file pycares uses the MIT license, check LICENSE file.
Supported Python versions
Python >= 3.5 are supported. Both CPython and PyPy are supported.
Contributing
If you’d like to contribute, fork the project, make a patch and send a pull request. Have a look at the surrounding code and please, make yours look alike :-)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for pycares-3.0.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a11b7d63c3718775f6e805d6464cb10943780395ab042c7e5a0a7a9f612735dd |
|
MD5 | ef4e384b8d1dc222f853e7cff78e4423 |
|
BLAKE2b-256 | 936106ffa46fdfbba5124ca5e96d56fd273e4877bedb271afffd5413db7519f6 |
Hashes for pycares-3.0.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f79c6afb6ce603009db2042fddc2e348ad093ece9784cbe2daa809499871a23 |
|
MD5 | 85e8e208aa59f87bc41c35558d6f2756 |
|
BLAKE2b-256 | 5dda949c533dd76926dc60dec00cada7feac5dcfcb602fb4427ced0158704162 |
Hashes for pycares-3.0.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 755187d28d24a9ea63aa2b4c0638be31d65fbf7f0ce16d41261b9f8cb55a1b99 |
|
MD5 | ecc7834fe95079e7f486718eb7eb33aa |
|
BLAKE2b-256 | d1441a9c0db0d38d4d25a08dc724cf9a9f3cd170ece4658db0b2621db6b07948 |
Hashes for pycares-3.0.0-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf08e164f8bfb83b9fe633feb56f2754fae6baefcea663593794fa0518f8f98c |
|
MD5 | fea6751159ac24800ceae6137faa3a95 |
|
BLAKE2b-256 | 5e29e06f9b7f2558dd5b28b6013889f0c4a28f6c476bf9366901490742bbba70 |
Hashes for pycares-3.0.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df9bc694cf03673878ea8ce674082c5acd134991d64d6c306d4bd61c0c1df98f |
|
MD5 | c814adec4da706861278a27b522f430d |
|
BLAKE2b-256 | f18be07859718e3a14131d277975f69c7ac888f2ef21d5bb5a36932800216d79 |
Hashes for pycares-3.0.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90b27d4df86395f465a171386bc341098d6d47b65944df46518814ae298f6cc6 |
|
MD5 | b1fd07a0f1c342a802e006d8cdfde52d |
|
BLAKE2b-256 | e3a1e615f4799ed4333bcfa7272e7df815eaa9485fef20e6f6ac16f1a0fe93f4 |
Hashes for pycares-3.0.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7baa4b1f2146eb8423ff8303ebde3a20fb444a60db761fba0430d104fe35ddbf |
|
MD5 | a3d08d6b4a4fafcc3509db4a43895351 |
|
BLAKE2b-256 | 88580cdc4e9aeaa19d91cf33cdc7590d5a08b2c78de73fde893580b4fa63b57b |
Hashes for pycares-3.0.0-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ca080db265ea238dc45f997f94effb62b979a617569889e265c26a839ed6305 |
|
MD5 | 2e3b0dde0fe3d948de3093dc50670777 |
|
BLAKE2b-256 | d104ce0ae81b4eb6580bc8d6b0267534dfa0f213114a1d2f94273e9f32be6cce |
Hashes for pycares-3.0.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70918d06eb0603016d37092a5f2c0228509eb4e6c5a3faacb4184f6ab7be7650 |
|
MD5 | 795793e35d9deb70c54fc6e670a3dab7 |
|
BLAKE2b-256 | f58d54556ced6d61000d13734866661b96f69257fec51625ff731b1cbf0bbda3 |
Hashes for pycares-3.0.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7f4f65e44ba35e35ad3febc844270665bba21cfb0fb7d749434e705b556e087 |
|
MD5 | dfe9cefc2baca57f5030cae4448f02cd |
|
BLAKE2b-256 | 2db84fcc4dc9636d0e76792210c3e89ba5251488f1a151779d8d1a857836397c |
Hashes for pycares-3.0.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdb342e6a254f035bd976d95807a2184038fc088d957a5104dcaab8be602c093 |
|
MD5 | 0011944a16f96d74ba078ab912768eec |
|
BLAKE2b-256 | 3a61e54b75001ace999f53cdb5ac229098cc10d245b2992338c02ff744a82117 |
Hashes for pycares-3.0.0-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e090dd6b2afa65cb51c133883b2bf2240fd0f717b130b0048714b33fb0f47ce |
|
MD5 | 20017506ee15ae08bf8f0248a8252a51 |
|
BLAKE2b-256 | 6b61078880e4ff09b355eac13aa836763f9211ce42ad4eb64e4a63ff69b44ce6 |