Skip to main content

SRV record resolver for python

Project description

SRV resolver

Helper to get record from SRV address according to RFC2782.

Features

  • support of record weights and priorities
  • check service availability at specific port
  • random record selector
  • cache with ttl support

Example

from srvresolver.srv_resolver import SRVResolver

# get all records
SRVResolver.resolve('_service._tcp.example.com')

# get one random record with working connection 
SRVResolver.resolve_random('_service._tcp.example.com')

# get first available server
SRVResolver.resolve_first('_service._tcp.example.com')

Adds

Resolver with DNS cache

This one uses cache implemented in dnspython module.

from srvresolver.srv_resolver_cached import SRVResolverCached

# get all records
SRVResolverCached.resolve('_service._tcp.example.com')
# same but don't do dns request, load from cache if not expired
SRVResolverCached.resolve('_service._tcp.example.com')

Postgres SRV record resolver

Extract postgres records from SRV and check whether master or slave. Requires psycopg2

from srvresolver.postgres_resolver import PostgresResolver

# get random working slave record
PostgresResolver.get_slave('_postgresql._tcp.example.com', username, password)

# get random working master record
PostgresResolver.get_master('_postgresql._tcp.example.com', username, password)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

srvresolver-0.3.3.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

srvresolver-0.3.3-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file srvresolver-0.3.3.tar.gz.

File metadata

  • Download URL: srvresolver-0.3.3.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for srvresolver-0.3.3.tar.gz
Algorithm Hash digest
SHA256 9eecdfd6f9a8415db60db29828ad80c127d856ebf98b5084ea5b5eda7ac1094c
MD5 2d1b62b0eb2c056fc27855ac7e790301
BLAKE2b-256 9690fff84ecdd1a29f73a89a1e44541a20b049f0d347fb59e01b47d9f2f73b8f

See more details on using hashes here.

File details

Details for the file srvresolver-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: srvresolver-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.2

File hashes

Hashes for srvresolver-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 077546480927b5c4bfb1bf29b7354e8bac72b03c54823ffbd3a31785163fa72b
MD5 6259102e362a7b44a1e35927e19111d3
BLAKE2b-256 c3af4c6f83945fb44219a28bec8265a5241d39e3492b7880ac93f84dfc0844b7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page