[Bug]: Unknown properties return None
评估
调研方向
从 Adyen/services/base.py 的第 13-16 行开始,这是 issue 中确定的根因位置。在 AdyenBase 子类上重现缺少属性的示例,并检查未知键是如何处理的。完成的标准是:不存在的属性会引发 AttributeError,而不是返回 None,包括嵌套的 API 对象。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Python
- 星标
- 68
- 派生
- 51
- 平均合并
- 2 小时 3 分钟
- 30 天内合并 PR
- 2
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Adyen/adyen-python-api-library 的其他 Issue
-
[Bug] api_*_version override has no effect on PAL-based service URLs可能已有人在做 @cobanfurkanx 于 11 天前认领。 未关闭Bug do not stale
难度 2/5 1-3 小时 新手友好度 75/100
-
Feature
难度 4/5 3-5 天 新手友好度 45/100
Adyen/adyen-python-api-library#487 · 1 条评论 · 1 个 reaction ·
-
[Test] Add baseUrl environment tests to all service test files可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭do not stale Test
难度 4/5 3-5 天 新手友好度 55/100
-
chore: consolidate package metadata into pyproject.toml (PEP 621)可能已有人在做 @erdemtuna 于 192 天前认领。 未关闭do not stale
难度 3/5 1-2 天 新手友好度 72/100
-
do not stale Feature
难度 5/5 一周以上 新手友好度 35/100
Adyen/adyen-python-api-library#395 · 1 个 reaction ·
查看 Adyen/adyen-python-api-library 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 77/100
lidofinance/diffyscan#239 ·
维护者通常 1 天内回复
-
area: tools documentation good first issue ready for a contributor
难度 2/5 1-3 小时 新手友好度 82/100
eyalgolan/statecraft-israel#873 · 1 条评论 ·
维护者通常 1 天内回复
-
GET rooms API returns 500 due to nonexistent Room.is_active attribute可能已有人在做 @Mars-60 今天认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 5 天内回复
-
Harmony OPeNDAP SubSetter (HOSS) Geographic production rssmif16d 7 XYZ_PROV
难度 2/5 1-3 小时 新手友好度 62/100
nasa/harmony-autotester#341 ·