kevin1024 / vcrpy

Automatically mock your HTTP interactions to simplify and speed up testing
MIT License
2.72k stars 389 forks source link

Feature request: make vcrpy work with both requests module and urllib module #537

Open AthulMuralidhar opened 4 years ago

AthulMuralidhar commented 4 years ago
elbart commented 4 years ago

I am not sure what you mean, but we use VCR.py along with requests (which uses urllib3 under the hood) and works like a charm here. What exactly do you mean?

AthulMuralidhar commented 4 years ago

hey, sorry for the late reply. I am running a django app and using pytest and vcrypy to mock api requests for my test cases. Whenever i use python requests with vcrpy i get this error:

--> 156             response = requests.get(url)
    157         # except urllib.error.HTTPError as error:

ipdb> n                                                                                                                                                       
AttributeError: 'Session' object has no attribute 'request'

resulting in failing tests, so i had to use python's urllib and that is why i raised this issue. Please let me know if more info is required

versions: django==1.8.7
pytest==5.3.2
vcrpy==4.0.2
Python==3.5.3