Open davepeck opened 11 years ago
Wow, I had no idea anyone was actually using this! It's been a very long time since I looked at this code.
I think it's actually supposed to support HTTPS (note the monkeypatching of httplib.HTTPSConnection
in replaylib/__init__.py
). It's possible this has bitrotted away from the inner workings of httplib
such that it no longer works.
Do you have any more info on what happens when you try to record an HTTPS request? I will try to take a more detailed look as well.
Thanks!
Howdy!
I was curious if I could use a tool like replaylib to to record and replay the API calls my integration tests make to Braintree's payment gateway. I ran across your library while evaluating others (vcr, cassette, http-replay, and a fork of httpretty) -- sorry if I filed an issue against old or unmaintained code.
I just went back to get a stack trace and... bad on me, it looks like the issue was the interaction of requests HTTPS and replaylib. (I didn't realize Braintree's API used requests under the hood.) The bit of the trace through Braintree:
braintree_result = braintree.Customer.create({"email": self.email})
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/braintree/customer.py", line 93, in create
return Configuration.gateway().customer.create(params)
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/braintree/customer_gateway.py", line 26, in create
return self._post("/customers", {"customer": params})
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/braintree/customer_gateway.py", line 88, in _post
response = self.config.http().post(url, params)
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/braintree/util/http.py", line 40, in post
return self.__http_do("POST", path, params)
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/braintree/util/http.py", line 55, in __http_do
status, response_body = http_strategy.http_do(http_verb, full_path, self.__headers(), request_body)
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/braintree/util/http_strategy/requests_strategy.py", line 16, in http_do
verify=self.environment.ssl_certificate
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/requests/api.py", line 98, in post
return request('post', url, data=data, **kwargs)
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/requests/safe_mode.py", line 39, in wrapped
return function(method, url, **kwargs)
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/requests/api.py", line 51, in request
return session.request(method=method, url=url, **kwargs)
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/requests/sessions.py", line 241, in request
r.send(prefetch=prefetch)
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/requests/models.py", line 626, in send
timeout=self.timeout,
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 410, in urlopen
conn = self._get_conn(timeout=pool_timeout)
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 225, in _get_conn
return conn or self._new_conn()
File "~/.virtualenvs/projectX/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 532, in _new_conn
connection = VerifiedHTTPSConnection(host=self.host, port=self.port)
File "~/.homebrew/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1149, in __init__
source_address)
TypeError: unbound method __init__() must be called with RecordingHTTPConnection instance as first argument (got VerifiedHTTPSConnection instance instead)
Anyway, feel free to close if this is not of interest (or if requests is out of scope.) Cheers.
Which would be really nice!