Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 1.04 KB

File metadata and controls

14 lines (10 loc) · 1.04 KB

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.