1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00
Commit Graph

44 Commits

Author SHA1 Message Date
Mathieu Virbel
3f78330c1e fix: usage of io-like interface with VCR.py (#906)
* fix: usage of io-like interface with VCR.py

* Update tests/integration/test_aiohttp.py

Co-authored-by: Jair Henrique <jair.henrique@gmail.com>

---------

Co-authored-by: Jair Henrique <jair.henrique@gmail.com>
2025-12-05 15:45:49 -05:00
Jair Henrique
bb690833bc Enables SIM ruff lint 2025-11-19 12:18:05 -03:00
Martin Brunthaler
ac230b76af Call urllib.parse less frequently 2025-01-04 15:42:49 -03:00
Mathieu Parent
241b0bbd91 Ensure body is consumed only once
Fixes: #846
Signed-off-by: Mathieu Parent <math.parent@gmail.com>
2024-07-21 22:53:45 +02:00
Jair Henrique
4f70152e7c Enable rule B (flake8-bugbear) on ruff 2023-06-27 17:36:26 -03:00
Jair Henrique
a77173c002 Use ruff as linter 2023-06-26 20:46:09 -03:00
Jair Henrique
b827cbe2da Drop support to python 3.7 2023-06-26 11:46:20 -03:00
Jair Henrique
0eece7f96e Add isort to code lint 2022-10-09 11:35:37 -03:00
Josh Peak
4a8e80ee3e v4.0.x - Remove legacy python and add python3.8 support (#499)
* Drop support for legacy Python 2.7

* Upgrade Python syntax with pyupgrade --py3-plus

* Trim testing matrix to remove python2

* re-enable python3.8 in travis as tests that are not allowed to fail

* Remove some six

* The future is now

* Remove Python 2 imports

* Add back example, but change py27 to py36

* Remove redundant compat.py

* Blacken

* Credit hugovk in changelog

WIP Updating Sphinx Docs and AutoDoc

* Fix AutoDoc and update Sphinx theme to python_doc_theme

* Fix #420, autodoc even undocumented (docstring-less) method signatures

* Doc theme 'nature'. Add global TOC to doc sidebar

* Comment last reference to package six

* Changelog is now a consistent format

* Yet another documentation fix for links and title hierarchy

* Start work on new SVG logo

test SVG in README

trying to test new SVG logo in README

Apply centering

Apply readme logo centering

Trying to align image

Trying random shit

trying align right

add emoji

Large logo has higher priority

Change title hierarchy

Actually use a H1

Try again

try and organise badges

revert link back to point at master

* updated new take on VCR logo as SVG code

* Testing modern logo in docs

* Add sanitize for rendering SVG

* Switch to alabaster theme

* Update vcrpy logo (#503)

* Add credit for V4 logo changes.

* Add rewind and play animation

* Add svg into ReadTheDocs static assets so that it can be hosted so the animations work.

* Need to embedd the SVG for ReadTheDocs somewhere so I can get the link to later embed in the README

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Sean Bailey <sean@seanbailey.io>
2019-12-20 11:45:07 +11:00
Josh Peak
7caf29735a Format project with black (#467)
Format with line length 110 to match flake8

make black part of linting check

Update travis spec for updated black requirements

Add diff output for black on failure

update changelog
2019-08-24 11:36:35 +10:00
Jan Gazda
347026f42c Fix #382 - boto3 compatibility
* Add support for PyYaml5.1
* Unpin requests in Tox
* Unpin urllib3 in Tox
* Unpin Flask in Tox
* Add env vars to Tox for boto3 tests
2019-07-13 12:51:50 +02:00
James E. King III
d4b706334c properly handle tunnel connect uri generation broken in #389 2019-06-28 13:37:14 +00:00
Hugo
8f4e089200 Upgrade Python syntax with pyupgrade 2019-05-22 17:44:36 +03:00
Felix Yan
0d2f49fe8a Fix a typo in vcr/request.py 2018-10-06 17:21:42 +08:00
Hugo
6156271c48 Automatic formatters supported in Python 2.7+ 2018-01-15 09:54:11 +02:00
Aron Griffis
7312229aef Add HeadersDict, and mark add_header deprecated.
HeadersDict is a subclass of CaseInsensitiveDict with two new features:

  1. Preserve the case of the header key from the first time it was set.
     This means that later munging won't modify the key case. (You can
     force picking up the new case with `del` followed by setting.)

  2. If the value is a list or tuple, unpack it and store the first
     element. This is the same as how `Request.add_header()` used to work.

For backward compatibility this commit preserves `Request.add_header()` but
marks it deprecated.
2015-08-25 06:30:50 -04:00
Aron Griffis
eda64bc3be Make request.headers always a CaseInsensitiveDict.
Previously request.headers was a normal dict (albeit with the
request.add_header interface) which meant that some code paths would do
case-sensitive matching, for example remove_post_data_parameters which
tests for 'Content-Type'. This change allows all code paths to get the same
case-insensitive treatment.

Additionally request.headers becomes a property to enforce upgrading it to
a CaseInsensitiveDict even if assigned.
2015-08-24 16:19:34 -04:00
Greg Ward
09b7ccf561 Ensure that request bodies are always bytes, not text (fixes #163).
It shouldn't matter whether the request body comes from a file or a
string, or whether it is passed to the Request constructor or assigned
later. It should always be stored internally as bytes.
2015-07-16 14:36:26 -04:00
Ivan Malison
b948ed4857 Fix python3 support for requests file uploads. 2015-03-24 15:41:14 -07:00
Ivan Malison
5bd40a447a Add setter to body on vcr's request. 2015-03-24 14:11:16 -07:00
Ivan Malison
6602a449b1 Add support for posting files through requests. closes #121. Possibly #134. 2015-03-24 14:11:16 -07:00
Abhinav Gupta
2473bdb77a Fix default port for HTTPS. 2015-02-23 23:37:04 -08:00
Kevin McCarthy
5e295e0603 Serialize dict of lists, use dicts internally
There is a weird quirk in HTTP.  You can send the same header twice.
For this reason, headers are represented by a dict, with lists as the
values.  However, it appears that HTTPlib is completely incapable of
sending the same header twice.  This puts me in a weird position: I want
to be able to accurately represent HTTP headers in cassettes, but I
don't want the extra step of always having to do [0] in the general
case, i.e.  request.headers['key'][0]

In addition, some servers sometimes send the same header more than once,
and httplib *can* deal with this situation.

Futhermore, I wanted to keep the request and response cassette format as
similar as possible.

For this reason, in cassettes I keep a dict with lists as keys, but once
deserialized into VCR, I keep them as plain, naked dicts.
2014-05-03 17:39:12 -10:00
Max Shytikov
3322234b25 Updated Request with stup to support default ports 2014-05-04 02:12:38 +02:00
Max Shytikov
5d1f35973d Make code 2.6 compatible 2014-05-02 07:32:17 +02:00
Max Shytikov
eab10578d5 Make Request headers to be a dict of lists 2014-05-02 07:32:15 +02:00
Max Shytikov
e4d1db0617 Removed frozenset 2014-04-30 02:38:01 +02:00
Max Shytikov
7e677f516d Deleted unnecessary __hash__ method of Request 2014-04-30 02:36:27 +02:00
Max Shytikov
1e995c3c9b Replaced yaml dump of Request object with plain dict dump 2014-04-30 02:36:26 +02:00
Max Shytikov
96d8782d08 Added 'protocol' to Request for backwards compatibility 2014-04-30 02:31:11 +02:00
Max Shytikov
4267828a3e Added 'scheme' to Request with matcher and test 2014-04-30 02:29:25 +02:00
Max Shytikov
9b188e986f Added query to Request with matcher and test 2014-04-30 02:27:52 +02:00
Max Shytikov
6b060e5666 Added path to Request with matcher and test 2014-04-30 02:27:52 +02:00
Max Shytikov
bd9fa773e8 Added port to Request with matcher and test 2014-04-30 02:27:52 +02:00
Max Shytikov
18ec57fa73 Added test and impl for Request 'host' attribute 2014-04-30 02:27:52 +02:00
Max Shytikov
edf1df9188 Replaced Request 'host, port, protocol, path' with 'uri' 2014-04-30 02:27:52 +02:00
Kevin McCarthy
e84cd6f059 Major Refactor of Stubs
So the stubs were getting out of hand, and while trying to add support for the
putrequest and putheader methods, I had an idea for a cleaner way to handle
the stubs using the VCRHTTPConnection more as a proxy object.  So
VCRHTTPConnection and VCRHTTPSConnection no longer inherit from HTTPConnection
and HTTPSConnection.  This allowed me to get rid of quite a bit of
copy-and-pasted stdlib code.
2014-03-08 19:22:58 -10:00
Kevin McCarthy
c8299103fb pep8 fixes 2013-08-23 20:35:43 -10:00
shu zOMG chen
51f0f1bacd Adding json serializer 2013-08-19 19:49:05 -10:00
Kevin McCarthy
a6c59c20d2 remove debugging code from Request and add repr 2013-08-11 17:51:33 -10:00
Kevin McCarthy
ec01955c68 lets store the proto too 2013-08-11 15:05:41 -10:00
Kevin McCarthy
59567a26cc lets make url the actual url instead of just the path 2013-08-11 15:05:41 -10:00
Kevin McCarthy
9ac03c889a hold counts in a Counter 2013-08-11 15:05:40 -10:00
Kevin McCarthy
87d27a7199 add requests class to sow the seeds of a custom matcher 2013-08-11 15:05:40 -10:00