question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

vcr doesn't record requests used within a library?

See original GitHub issue

I am using github3, and want to test it. This is what I used:

  1 import os
  2 
  3 import vcr
  4 import github3
  5 
  6 @vcr.use_cassette('github.yaml')
  7 def test_github3():
  8     gh = github3.GitHub(token=os.environ.get('GH_TOKEN'))
  9     coala = gh.organization('coala')

when I run this test, the cassete is not recorded

github3 uses a GitHubSession session which inherits from requests.Session internally

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

1reaction
DanielLevy0705commented, Aug 12, 2020

I’m using VCR and i’m having a similar problem as described here. I’m using zeep SOAP client, with requests.Session for transport, and seems like it doesn’t intercept HTTP requests. On the other hand I’m using requests.Session() also for REST HTTP requests and it seems to intercept and record these, is there any solution?

1reaction
rfadamscommented, Jul 30, 2017

@meetmangukiya @georgedorn @IvanMalison I had a similar issue, but with a “client” we developed internally that also uses the “requests” library. I spent a while trying to diagnose the issue to no avail. What was most frustrating is that since it is an internal client, it is used in another codebase as well and VCRpy was working great over there.

Finally, I had the idea to downgrade VCRpy in the new codebase to the same version as used in the old codebase and it worked! Here is a screenshot (below) showing a failing test b/c it bypasses VCRpy, I uninstall VCRpy==1.11.1, and re-install VCRpy==1.11.0 - then the test passes!

I tried various different configs and methods of using VCRpy (decorator vs with-context) all to no avail, it just wouldn’t see the http requests made by the “requests” lib inside the API client. Sorry I don’t have more help.

image 2017-07-30 at 8 54 16 am public
Read more comments on GitHub >

github_iconTop Results From Across the Web

vcrpy record cassettes doesn't record in a test using test_client ...
I wrote a test but I would like to record the response of the request and vcr is not recording the response. My...
Read more >
vcr: Record 'HTTP' Calls to Disk
Works by hooking into the 'webmockr'. R package for matching 'HTTP' requests by various rules ('HTTP' method,. 'URL', query parameters, headers, ...
Read more >
Advanced Features — vcrpy 4.2.1 documentation
If you want, VCR.py can return information about the cassette it is using to record your requests and responses. This will let you...
Read more >
Configuration - PHP-VCR
Library hooks can only intercept HTTP requests if PHP-VCR is turned on right after initializing your autoloader, before the actual class to be...
Read more >
Changelog - Vcr - Relish
Add VCR::Cassette#originally_recorded_at for use when freezing time based on ... Fix FakeWeb library hook so that it records the request body when using ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found