NoneType' object has no attribute 'items'
还没有人认领这个 Issue。
评估
调研方向
从 cloudfoundry_client/v2/entities.py 中的 _list 和 cloudfoundry_client/v2/apps.py 中的 _Application 构造函数开始,使用提供的 traceback 以及重复执行的 client.v2.apps 和 client.v2.buildpacks 循环作为复现路径。确定为什么一个列出的资源在 10–15 分钟后会有 null entity,并为该响应添加回归测试;完成标准是循环不再引发 AttributeError。
由索引模型根据 Issue 内容生成。
描述
Hi There
Stumbled upon this issue when building out a flask application but have also noticed this when just testing the code in a simple consistent loop.
Looking for pointers if there is something obvious I am missing in this.
Using Username/Password to authenticate.
Error usually occurs after 10-15 mins of running without issue.
SCRIPT CODE
foundation_name = 'lab'
target_endpoint = '<URL>'
proxy = dict(http=os.environ.get('HTTP_PROXY', ''), https=os.environ.get('HTTPS_PROXY', ''))
client = CloudFoundryClient(target_endpoint, proxy=proxy, verify=False)
client.init_with_user_credentials('<USERNAME>','<PAASWORD>')
def app_buildpacks():
app_buildpack_usage = []
app_buildpack_table_field_names = ['App Name', 'Buildpack Used', ' Buildpack Stack', 'GUID', 'Filename' , 'Locked']
for app in client.v2.apps:
app_name = app['entity']['name']
app_buildpack_name = app['entity']['detected_buildpack'] or app['entity']['buildpack']
app_buildpack_guid = app['entity']['detected_buildpack_guid']
for buildpack in client.v2.buildpacks:
buildpack_guid = buildpack['metadata']['guid']
if app_buildpack_guid == buildpack_guid:
buildpack_name = buildpack['entity']['name']
buildpack_stack = buildpack['entity']['stack']
buildpack_filename = buildpack['entity']['filename']
buildpack_lock = buildpack['entity']['locked']
d = {
'app_name' : app_name ,
'buildpack_name' : buildpack_name,
'buildpack_stack' : buildpack_stack ,
'buildpack_guid' : buildpack_guid,
'buildpack_filename': buildpack_filename,
'buildpack_lock' : buildpack_lock
}
app_buildpack_usage.append(d)
# Sort the list by name
app_buildpack_usage = sorted(app_buildpack_usage, key = lambda i: i['buildpack_name'])
# Return the two values ( Builpack usage list of dicts and table headers )
return app_buildpack_usage,app_buildpack_table_field_names
def background():
global app_buildpack_usage, app_buildpack_table_field_names
while True:
try:
app_buildpack_usage,app_buildpack_table_field_names = app_buildpacks()
def foreground():
@app.route('/app_buildpacks')
def app_buildpacks_page():
return render_template('app_buildpack_table.html', colnames=app_buildpack_table_field_names, app_buildpack_usage=app_buildpack_usage)
b = threading.Thread(name='background', target=background)
f = threading.Thread(name='foreground', target=foreground)
b.start()
f.start()
ERROR
\Python37\lib\site-packages\cloudfoundry_client\v2\entities.py", line 66, in _list
yield entity_builder(list(resource.items()))
\Python37\lib\site-packages\cloudfoundry_client\v2\apps.py", line 51, in <lambda>
lambda pairs: _Application(target_endpoint, client, pairs))
\Python37\lib\site-packages\cloudfoundry_client\v2\entities.py", line 17, in __init__
for attribute, value in list(self['entity'].items()):
AttributeError: 'NoneType' object has no attribute 'items'
- 主要语言
- Python
- 星标
- 55
- 派生
- 54
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cloudfoundry-community/cf-python-client 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 45/100
cloudfoundry-community/cf-python-client#218 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
cloudfoundry-community/cf-python-client#180 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
cloudfoundry-community/cf-python-client#177 · 2 条评论 ·
查看 cloudfoundry-community/cf-python-client 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
cellrishi-code/claude-skills-atlas#165 ·
维护者通常 1 天内回复
-
bug confirmed issue
难度 2/5 1-3 小时 新手友好度 72/100
open-webui/open-webui#32635 · 1 条评论 ·
维护者通常 1 天内回复
-
Filters: ?field:ne=null matches NULL rows instead of non-NULL ones可能已有人在做 @rshdhere 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
Netflix/metaflow-service#504 ·
-
needs-triage
难度 2/5 1-3 小时 新手友好度 84/100
gke-labs/kube-agents#3394 ·
维护者通常 1 天内回复
-
A2A audit timestamps end in +00:00Z (invalid ISO 8601)可能已有人在做 @O1sumitkumar 今天认领。 未关闭bug good first issue help wanted python
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复