Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: Unknown properties return None

未关闭
#397 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@gourabsingha1 已经在做这个了。

开始于 2026年6月27日。

  • #492 来自 @gourabsingha1 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
api, payments

调研方向

从 Adyen/services/base.py 的第 13-16 行开始,这是 issue 中确定的根因位置。在 AdyenBase 子类上重现缺少属性的示例,并检查未知键是如何处理的。完成的标准是:不存在的属性会引发 AttributeError,而不是返回 None,包括嵌套的 API 对象。

由索引模型根据 Issue 内容生成。

描述

do not stale
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:

https://github.com/Adyen/adyen-python-api-library/blob/fa8079ff69022117f4375a806ee51e82babce56f/Adyen/services/base.py#L13-L16

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

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Adyen/adyen-python-api-library 的其他 Issue

查看 Adyen/adyen-python-api-library 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。