python - Profile object does not deserialize `core_attributes` correctly - Azure Devops Python API
问题描述
This is a copy of an issue I opened on the project itself, so sorry in advance for the duplicate.
I am trying to get some profiles by id and I cannot figure out if there is a bug in this library or if I am not using it correctly, but when I get a profile with a call like:
profile_client = connection.clients_v6_0.get_profile_client()
a_profile = profile_client.get_profile(authenticated_user_id, details=True)
I see that data like the Avatar
is coming back from the http request log
...
'Avatar': {'descriptor': {'attributeName': 'Avatar',
'containerName': 'Core'},
'value': {'value': 'iVBORw0KGgoAAAANSUhEUgAAACwAAAAsCAYAAAAehFoBAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGQSURBVFhH7ZUxSwQxEEb9Odb29va2cpWVWIqdjWB7FldoowhWilhpo811FoqdhYVgpaU/IfIC3zEXs8seZBBlBh6bTXKbl2SSW9pYnqS/RAh7E8LehLA3IexNCHsTwt6EsDf/X3h79TSNt27S2f40Q5k622dv/SK38bT1JZsrx7Nv1NprDBbm49Orl0TcnjzPhF+fPnKd7Us98fn+NVdfon6P92/V9hqDhJFFDGHKZfvO2vncOyLIEn2rTNCvuTArinCtrYZWjgl2yZAGkm0qTH4Si+SZhFldosxxQJZ+zYUPRtd50FoqdCFhyuwMO2TbNRG+2VzYDm6xNwXYVbS/oR9hJ4ygJtFc+Gj37seAIGEGJuzhssKg7aesFNMEmwtzAxCkRq1d29snzDvSlJmgFWwuDH1XzxBhdofQbtm+LsJa5fLwwBBhUOpopYWLMCDNYHB5+JClePJO2D+PmnDX9egmLFhJhATv5YFUH1sHpETt8JaT6GNh4d8mhL0JYW9C2JsQ9iaEvQlhb0LYl0n6Bknoed5LlvAdAAAAAElFTkSuQmCC',
'timeStamp': '2020-12-09T16:53:10.5466667+00:00',
'size': 'medium',
'isAutoGenerated': True},
'timeStamp': '2020-12-09T16:53:10.5466667+00:00'},
...
but if I serialize the Profile object, I do not see anything
a_profile.as_dict()
...
{'core_attributes': {'DisplayName': {},
'PublicAlias': {},
'EmailAddress': {},
'UnconfirmedEmailAddress': {},
'CountryName': {},
'TermsOfServiceVersion': {},
'TermsOfServiceAcceptDate': {},
'Avatar': {},
'ContactWithOffers': {}},
...
and even if I get the Avatar object from a_profile.core_attributes
, the object does not seem to contain anything.
NOTE: using the v5.1 gives the exact same result
Is there a problem with the library or I am not using it correctly?
Thanks a lot in advance e for your help.
UPDATE: I made some additional research and realized that this change actually triggers a serialization
diff --git a/azure-devops/azure/devops/v5_1/profile/models.py b/azure-devops/azure/devops/v5_1/profile/models.py
index b527f6c..27f9e0d 100644
--- a/azure-devops/azure/devops/v5_1/profile/models.py
+++ b/azure-devops/azure/devops/v5_1/profile/models.py
@@ -264,11 +264,8 @@ class CoreProfileAttribute(ProfileAttributeBase):
"""
- _attribute_map = {
- }
-
- def __init__(self):
- super(CoreProfileAttribute, self).__init__()
+ def __init__(self, **kwargs):
+ super(CoreProfileAttribute, self).__init__(**kwargs)
I am still not convinced this is a correct desirialization, but I am pretty sure that now there is a bug in the library.
解决方案
推荐阅读
- r - 通过单个变量对数据框进行增量分箱,同时对所有其他变量取平均值
- mongodb - Haskell MongoDB 对象到 Bson
- go - 模板:是一个不完整或空的模板
- vim - 修复 GVIM 中的自动行
- java - 遵循 Grails Spring Security Core 教程时出现“没有正在进行的事务”错误
- wcf - 远程服务器返回错误:(413) Request Entity Too Large WCF Application
- java - 我如何在本地构建corda项目?
- python - 删除出现在两列或多列Python中的重复项
- java - ConcurrentModificationException - Lamport 分布式系统
- python - 安装 apache-airflow:alembic 失败