-[
- {
- "request": {
- "body": null,
- "headers": {
- "Accept": ["*/*"],
- "Accept-Encoding": ["gzip, deflate, compress"],
- "User-Agent": ["python-requests/2.2.1 CPython/2.6.1 Darwin/10.8.0"]
+{
+ "version": 1,
+ "interactions":
+ [
+ {
+ "request": {
+ "body": null,
+ "headers": {
+ "Accept": ["*/*"],
+ "Accept-Encoding": ["gzip, deflate, compress"],
+ "User-Agent": ["python-requests/2.2.1 CPython/2.6.1 Darwin/10.8.0"]
+ },
+ "method": "GET",
+ "uri": "http://httpbin.org/ip"
},
- "method": "GET",
- "uri": "http://httpbin.org/ip"
- },
- "response": {
- "status": {
- "message": "OK",
- "code": 200
- },
- "headers": {
- "access-control-allow-origin": ["*"],
- "content-type": ["application/json"],
- "date": ["Mon, 21 Apr 2014 23:13:40 GMT"],
- "server": ["gunicorn/0.17.4"],
- "content-length": ["32"],
- "connection": ["keep-alive"]
- },
- "body": {
- "string": "{\n \"origin\": \"217.122.164.194\"\n}"
+ "response": {
+ "status": {
+ "message": "OK",
+ "code": 200
+ },
+ "headers": {
+ "access-control-allow-origin": ["*"],
+ "content-type": ["application/json"],
+ "date": ["Mon, 21 Apr 2014 23:13:40 GMT"],
+ "server": ["gunicorn/0.17.4"],
+ "content-length": ["32"],
+ "connection": ["keep-alive"]
+ },
+ "body": {
+ "string": "{\n \"origin\": \"217.122.164.194\"\n}"
+ }
}
}
- }
-]
+ ]
+}
def deserialize(cassette_string, serializer):
data = serializer.deserialize(cassette_string)
+ if not isinstance(data, dict):
+ raise ValueError(
+ "Your cassette files were generated in an older version "
+ "of VCR. Delete your cassettes or run the migration script."
+ "See http://git.io/mHhLBg for more details."
+ )
+
requests = [Request._from_dict(r['request']) for r in data['interactions']]
responses = [compat.convert_to_bytes(r['response']) for r in data['interactions']]
return requests, responses