Skip to content

pstiasny/requests-srv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

requests_srv

A simple wrapper/plugin for requests for RFC-2782 style services, i.e. for FQDNs starting with an underscore it will access a resource pointed by an SRV record instead of the A record. Useful for seamless service discovery with DNS-based service discovery service like Consul.

Use as a drop-in replacement for requests

import requests_srv as requests
print requests.get('http://_consul._http.service.consul/v1/catalog/services').text

Use with your custom session

from requests import Session
from requests_srv import SRVResolverHTTPAdapter

session = Session()
session.mount('http://_', SRVResolverHTTPAdapter())
session.mount('https://_', SRVResolverHTTPAdapter())

Run tests

Test environent is set up in docker containers. To set up and run:

bash test.sh

License

Just as requests, request_srv is licensed under the Apache License, version 2.0

You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

About

A wrapper for Requests supporting DNS SRV records.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published