Ability to set real_http for specific pattern
Bug #1501665 reported by
Michael van Tellingen
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
requests-mock |
Fix Released
|
Wishlist
|
Jamie Lennox |
Bug Description
Using requests-mock in combination with suds requests I want to mock https:// calls but not file:// calls since that is used to load wsdl's available in the project.
Would be cool to add for example: requests.
Changed in requests-mock: | |
milestone: | none → 1.1 |
To post a comment you must log in.
Interesting, i'd never really considered doing file:// based stuff through requests.
I'll have a think about how you can do this, but if you're looking for a solution today you could probably do something like:
adapter = requests_ mock.Adapter( )
session = requests.Session() mount(' http', adapter) mount(' https', adapter)
session.
session.
adapter. get(':/ /test.com/ path', text='text') # set up the mock ignoring protocol
resp = session.get('http:// test.com/ path) # do the request