You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like the only way to tell if a request response actually comes from a cassette or is a real, fresh response of some API is to use the logging mechanism described for debugging here: https://vcrpy.readthedocs.io/en/latest/debugging.html. It would be helpful to have a simpler way without involving the logging machinery, maybe by writing a flag into vcr.VCR objects.
The text was updated successfully, but these errors were encountered:
Well, something like this might work. Is this the recommended way?
importvcrfromvcr.cassetteimportCassettefromvcr.requestimportRequestpath='headers.yml'# execute one request, record responsewithvcr.use_cassette(path):
resp=requests.get('http://httpbin.org/headers')
# test if some request has been recorded req=Request('GET', 'http://httpbin.org/headers', 'irrelevant body?', {'foo': 'not checked'})
assertCassette(None).load(path=path).can_play_response_for(req) ==TrueassertreqinCassette(None).load(path=path)
A lot of changes have happened to VCRpy since this ticket was opened. As this ticket has become stale and we have a lot of old tickets that need to be groomed, I'm closing this for now to make it easier to see what is still relevant.
However if it is still needed, please feel free to re-open or create a new ticket.
It seems like the only way to tell if a request response actually comes from a cassette or is a real, fresh response of some API is to use the logging mechanism described for debugging here: https://vcrpy.readthedocs.io/en/latest/debugging.html. It would be helpful to have a simpler way without involving the logging machinery, maybe by writing a flag into
vcr.VCR
objects.The text was updated successfully, but these errors were encountered: