question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VCR.py doesn't work well with subclasses of HTTPSConnection

See original GitHub issue

Project I’m working on uses chargebee python client. I decided to give VCR.py a try and instantly got this exception:

  File "/project/path/code.py", line 23, in validate_chargebee_id
    chargebee.Customer.retrieve(value)
  File "/venv/path/lib/python3.4/site-packages/chargebee/models/customer.py", line 29, in retrieve
    return request.send('get', request.uri_path("customers",id), None, env, headers)
  File "/venv/path/lib/python3.4/site-packages/chargebee/request.py", line 14, in send
    response = http.request(method, url, env, ser_params, headers)
  File "/venv/path/lib/python3.4/site-packages/chargebee/http.py", line 34, in request
    connection = compat.VerifiedHTTPSConnection(meta.netloc)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/http/client.py", line 1203, in __init__
    super(HTTPSConnection, self).__init__(host, port, timeout,
TypeError: super(type, obj): obj must be an instance or subtype of type

By searching issues I’ve found the same exception in https://github.com/kevin1024/vcrpy/issues/183, but not sure if it’s because of the same reason, hope someone more familiar with VCR.py code can tell how to fix that.

VerifiedHTTPSConnection is defined here

MRO of classes at the moment of failure:

ipdb> HTTPSConnection.__mro__
(<class 'vcr.patch.VCRHTTPSConnectioncassettes/test_webhook_events/test_add_charge'>, <class 'vcr.stubs.VCRHTTPSConnection'>, <class 'vcr.stubs.VCRConnection'>, <class 'object'>)

ipdb> self.__class__.__mro__
(<class 'chargebee.compat.VerifiedHTTPSConnection'>, <class 'http.client.HTTPSConnection'>, <class 'http.client.HTTPConnection'>, <class 'object'>)

Python 3.4.3 vcrpy==1.7.4 chargebee==1.5.4

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
felipeadcommented, Nov 14, 2017

I’m having exactly the same issue while trying to use VCR.py along with PyGithub.

1reaction
fialovycommented, Mar 2, 2020

I’m having a similar issue when using VCRpy to test some ofxclient calls.

Dropping a breakpoint in __init__ of HTTPSConnection, I see:

  /home/njulian/tests/test_banking.py(166)test__getSvbCheckingAccounts()
-> self.svbClient.authenticateWithSvb()
  /home/njulian/tests/banking.py(89)authenticateWithSvb()
-> self.svb.authenticate(svbMd.username, svbMd.pin)
  /home/njulian/tests/ve/lib/python3.7/site-packages/ofxclient/institution.py(118)authenticate()
-> res = client.post(query)
  /home/njulian/tests/ve/lib/python3.7/site-packages/ofxclient/client.py(104)post()
-> h = HTTPSConnection(host, timeout=60)
> /usr/lib/python3.7/http/client.py(1367)__init__()
-> def __init__(self, host, port=None, key_file=None, cert_file=None,
(Pdb) self
<http.client.HTTPSConnection object at 0x7fde15fb7320>
(Pdb) HTTPSConnection
<class 'vcr.patch.VCRHTTPSConnectionbankingTestData.BANKING_CASSETTE_DIR/test_SvbClient_getSvbCheckingAccounts.yaml'>
(Pdb) super(HTTPSConnection, self)
*** TypeError: super(type, obj): obj must be an instance or subtype of type
(Pdb)

I am using:

  • vcrpy==4.0.2
  • ofxclient==2.0.3
  • python 3.7

So I think the issue persists, if the same thing is going on here. I don’t seem to have rights to re-open, but I can add a new if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

vcr.patch — vcrpy 4.2.1 documentation
HTTPSConnection # Try to save the original types for boto3 try: from ... This behavior is necessary to properly support nested cassette contexts....
Read more >
The Best Ways to Organize Your Files with Tags and Labels
How to organize your files, photos, emails, and more with a tagging system.
Read more >
Understanding the Connection Types for Your TV, Internet and ...
Identify multiple ways to connect to your television, home theatre or audio system.
Read more >
Connect a device to the Android TV/Google TV VIDEO IN jack ...
If not supplied with your TV, purchase the correct cable. Go to Parts and Accessories. Connect the 3.5 mm mini-jack of the RCA...
Read more >
RFC 5545: Internet Calendaring and Scheduling Core Object ...
Network Working Group B. Desruisseaux, Ed. Request for Comments: 5545 ... While the iCalendar object is not a profile of the text/directory media...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found