Skip to content

Example of a Requests transport adapter that supports specification of source address

License

Notifications You must be signed in to change notification settings

RhubarbSin/example-requests-transport-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Requests v1.2.3 doesn’t expose httplib’s support (since Python 2.7) for specifying the source address for binding the socket used by HTTPConnection:

This is what connection adapters are for.

The example in adapter.py shows a basic implementation of a transport adapter that supports a src_addr keyword argument for specifying the source address. It has the following limitations because I did the simplest thing that could possibly work for my requirements:

  • Requires Python 2.7+ for source address support in httplib or http.client.
  • Not tested with Python 3.
  • Supports only HTTPS.
  • Doesn’t validate SSL credentials.

About

Example of a Requests transport adapter that supports specification of source address

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages