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

add requests class to sow the seeds of a custom matcher

This commit is contained in:
Kevin McCarthy
2013-08-07 19:09:21 -10:00
parent 0e003575a1
commit 87d27a7199
5 changed files with 170 additions and 163 deletions

18
vcr/request.py Normal file
View File

@@ -0,0 +1,18 @@
class Request(object):
def __init__(self, host, port, method, url, body, headers):
self.host = host
self.port = port
self.method = method
self.url = url
self.body = body
self.headers = frozenset(headers.items())
def __key(self):
return (self.host, self.port, self.method, self.url, self.body, self.headers)
def __hash__(self):
return hash(self.__key())
def __eq__(self, other):
return hash(self) == hash(other)