Compatibility issue with Python3
minqz2009 opened this issue · 3 comments
Python version: 3.6.9
Library version: 2.2.0
Description
I tried to test the adyen library on python3 and it kept giving me this error
Traceback (most recent call last): File "adyenTest.py", line 20, in <module> result = adyen.checkout.payment_methods(request) File "/home/dchen/.local/lib/python3.6/site-packages/Adyen/services.py", line 297, in payment_methods return self.client.call_checkout_api(request, action, **kwargs) File "/home/dchen/.local/lib/python3.6/site-packages/Adyen/client.py", line 461, in call_checkout_api **kwargs) File "/home/dchen/.local/lib/python3.6/site-packages/Adyen/httpclient.py", line 196, in _requests_post headers=headers, timeout=timeout) File "/home/dchen/.local/lib/python3.6/site-packages/requests/api.py", line 116, in post return request('post', url, data=data, json=json, **kwargs) File "/home/dchen/.local/lib/python3.6/site-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, **kwargs) File "/home/dchen/.local/lib/python3.6/site-packages/requests/sessions.py", line 519, in request prep = self.prepare_request(req) File "/home/dchen/.local/lib/python3.6/site-packages/requests/sessions.py", line 462, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/home/dchen/.local/lib/python3.6/site-packages/requests/models.py", line 314, in prepare self.prepare_headers(headers) File "/home/dchen/.local/lib/python3.6/site-packages/requests/models.py", line 448, in prepare_headers check_header_validity(header) File "/home/dchen/.local/lib/python3.6/site-packages/requests/utils.py", line 942, in check_header_validity raise InvalidHeader("Invalid return character or leading space in header: %s" % name) requests.exceptions.InvalidHeader: Invalid return character or leading space in header: User-Agent
I then tested the same code on python 2 which was totally fine, I'm wondering if it's a compatibility issue with python 3?
Ok, so after looking into your code, I found I need to give an app_name, otherwise the header will have a leading whit space, maybe you guys can fix this by giving an default app_name
Hello @minqz2009,
We created an internal ticket to handle the default app_name and we will pick it up as soon as possible.
Kind regards,
Alexandros
It is fixed in version 3.0.0