vcrpy icon indicating copy to clipboard operation
vcrpy copied to clipboard

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

Open AthulMuralidhar opened this issue 5 years ago • 2 comments
trafficstars

  • currently we need to use the ulrllib module to make our responses
  • we should be able to use the requests module which will increase the usability of vcrpy as a whole

AthulMuralidhar avatar Jun 25 '20 08:06 AthulMuralidhar

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?

elbart avatar Jul 29 '20 12:07 elbart

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

AthulMuralidhar avatar Aug 19 '20 09:08 AthulMuralidhar