Adyen / Adyen/adyen-python-api-library
[Bug]: Unknown properties return None
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 68
- Forks
- 49
- Avg merge
- 2h 3m
- Merged PRs (30d)
- 2
Description
Description
Accessing a non-existent property on an API returns None instead of raising an AttributeError
Steps to reproduce
Attempt to access any non-existent attribute on any subclass of AdyenBase
>>> from Adyen import Adyen
>>> api = Adyen(xapikey='token', platform='test')
>>> print(api.foobar)
None
>>> print(api.payment.payments_api.foobar)
None
>>> api.payment.payments_api.fizz()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable
Actual behavior
Attempting to access non-existent attribute returns None. Attempting to call a non-existent method throws a "NoneType object is not callable" error.
Expected behavior
Should return an AttributeError.
Code snippet or screenshots (if applicable)
Root cause is here:
If key doesn't exist in self.client, the method exits with no return statement, which is the same as returning None. This means any attribute that's requested defaults to None. It should instead raise AttributeError
Adyen Python API Library version
14.0.0
Python Language version
Python 3.10
Operating System
macOS
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Adyen/services/base.py at lines 13-16, the root-cause location identified in the issue. Reproduce the missing-attribute examples on AdyenBase subclasses and inspect how unknown keys are handled. Done means nonexistent attributes raise AttributeError instead of returning None, including nested API objects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, payments
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100