1

I need a way specify the source interface for my http get requests, which can be either ppp1 or ppp2 interface. Currently I m using pycurl

curlObj.setopt(pycurl.URL,url)
curlObj.setopt(pycurl.CONNECTTIMEOUT,45)
curlObj.setopt(pycurl.INTERFACE,lastInterface)

Can this be done using python requests module?

  • Not out of the box, no. See [Source interface with Python and urllib2](http://stackoverflow.com/q/1150332) for what it'll take, but applied to `urllib3` rather than `urllib2` in you case. – Martijn Pieters Oct 13 '14 at 08:20
  • Also relevant perhaps: [There will be error if use monkey patching for requests lib to bind source IP & port with threading lib](http://stackoverflow.com/q/23002367) – Martijn Pieters Oct 13 '14 at 08:21
  • 1
    And definitely relevant: [Requests, bind to an ip](http://stackoverflow.com/q/12585317); all you need to do is look up the IP address of the interface in that case. – Martijn Pieters Oct 13 '14 at 08:22

0 Answers0