cancel
Showing results for 
Search instead for 
Did you mean: 

Expected Timeframe for Upgrading PYXB To A Version Compatible With Python > 3.9?

Hello everyone,
 
I am a developer that is leveraging Authorize.Net for purchases on my application. My application requires usage of Python 3.10 and above.
When I tried to use your ‘authorizenet' Python package in my application, I received the following error: 
 
AttributeError: module 'collections' has no attribute ‘MutableSequence'
 
This is due to the developers of Python moving MutableSequence into ‘collections.abc’. The correct path should now be ‘collections.abc.MutableSequence’ on Python versions greater than 3.9.
 
Now to the meat of the issue:
 
This error in your ‘authorizenet’ Python package is originating from within 'apicontractsv1.py’, specifically from its usage of the external package ‘pyxb’. Pyxb has reached end of life, and is unfortunately no longer compatible with modern versions of Python.
 
I would appreciate it if you updated your Python package to be compatible with python 3.10 and above!
 
 
Recommendations:
 
Here is a package I found that could quickly and easily fix the issue: https://github.com/renalreg/PyXB-X
 
It is a port of pyxb intended for modern versions of Python. All you would need to do is utilize that package instead and regenerate the corresponding bindings.
faugermire1
Member
3 REPLIES 3

Hey faugermire1.  I was frustrated with this issue as well.  With the age of the package, I decided to just use requests to make the calls.  Fundamentally they are using requests.post of an xml object.  I am using constants.SANDBOX to get the dev environment url and constants.PRODUCTION to get the production environment url.  With the url I'm making a call to requests.post.  I'm using a json object instead of xml for readability and so I could test with the Live API call json objects.

Ex:

def get_portal_token(self, amount, profile, line_items):
if Config.get('PAYMENT_PORTAL', 'dev'):
url = constants.SANDBOX
else:
url = constants.PRODUCTION

r = requests.post(url, json={
"getHostedPaymentPageRequest": {
"merchantAuthentication": self.get_merchant_auth(),
"transactionRequest": self.get_transaction_request(amount, profile, line_items),
"hostedPaymentSettings": {
"setting": self.get_portal_settings()
}
}
})
return json.loads(r.text[1:])
jrussell
Member

 

Hey there,

I totally get where you're coming from! It looks like you're running into a snag with the 'authorizenet' Python package because of some changes in Python versions, right? The error you're facing is because of this 'pyxb' thing which sadly doesn't play well with newer Python versions. The good news is, there's this cool fix-up package called 'PyXB-X' that's designed to work with the latest Python versions. You can easily swap out the old 'pyxb' with 'PyXB-X' and get your app back on track. Hope that helps!

 


Was this response better or worse?
Better
Worse
Same

 

ericfc
Member

@ericfc wrote:

 

Hey there,

I totally get where you're coming from! It looks like you're running into a snag with the 'authorizenet' Python package because of some changes in Python versions, right? The error you're facing is because of this 'pyxb' thing which sadly doesn't play well with newer Python versions. The good news is, there's this cool fix-up package called 'PyXB-X' that's designed to work with the latest Python versions. You can easily swap out the old 'pyxb' with 'PyXB-X' and get your app back on track. Hope that helps!

 


Was this response better or worse?
Better
Worse
Same

 


I hope my this reply is very helpful to you.