{"action":"closed","issue":{"url":"https://api.github.com/repos/chinapnr/fishbase/issues/76","repository_url":"https://api.github.com/repos/chinapnr/fishbase","labels_url":"https://api.github.com/repos/chinapnr/fishbase/issues/76/labels{/name}","comments_url":"https://api.github.com/repos/chinapnr/fishbase/issues/76/comments","events_url":"https://api.github.com/repos/chinapnr/fishbase/issues/76/events","html_url":"https://github.com/chinapnr/fishbase/issues/76","id":336937331,"node_id":"MDU6SXNzdWUzMzY5MzczMzE=","number":76,"title":"get_obj_attr_dict，获得对象的属性，并以字典的形式返回","user":{"login":"mindjun","id":38778480,"node_id":"MDQ6VXNlcjM4Nzc4NDgw","avatar_url":"https://avatars2.githubusercontent.com/u/38778480?v=4","gravatar_id":"","url":"https://api.github.com/users/mindjun","html_url":"https://github.com/mindjun","followers_url":"https://api.github.com/users/mindjun/followers","following_url":"https://api.github.com/users/mindjun/following{/other_user}","gists_url":"https://api.github.com/users/mindjun/gists{/gist_id}","starred_url":"https://api.github.com/users/mindjun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mindjun/subscriptions","organizations_url":"https://api.github.com/users/mindjun/orgs","repos_url":"https://api.github.com/users/mindjun/repos","events_url":"https://api.github.com/users/mindjun/events{/privacy}","received_events_url":"https://api.github.com/users/mindjun/received_events","type":"User","site_admin":false},"labels":[{"id":373696903,"node_id":"MDU6TGFiZWwzNzM2OTY5MDM=","url":"https://api.github.com/repos/chinapnr/fishbase/labels/feature","name":"feature","color":"006b75","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/chinapnr/fishbase/milestones/2","html_url":"https://github.com/chinapnr/fishbase/milestone/2","labels_url":"https://api.github.com/repos/chinapnr/fishbase/milestones/2/labels","id":3447593,"node_id":"MDk6TWlsZXN0b25lMzQ0NzU5Mw==","number":2,"title":"v1.0.15","description":"通用组件新增，现有组件优化，问题修复等","creator":{"login":"iTaa","id":13126814,"node_id":"MDQ6VXNlcjEzMTI2ODE0","avatar_url":"https://avatars3.githubusercontent.com/u/13126814?v=4","gravatar_id":"","url":"https://api.github.com/users/iTaa","html_url":"https://github.com/iTaa","followers_url":"https://api.github.com/users/iTaa/followers","following_url":"https://api.github.com/users/iTaa/following{/other_user}","gists_url":"https://api.github.com/users/iTaa/gists{/gist_id}","starred_url":"https://api.github.com/users/iTaa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iTaa/subscriptions","organizations_url":"https://api.github.com/users/iTaa/orgs","repos_url":"https://api.github.com/users/iTaa/repos","events_url":"https://api.github.com/users/iTaa/events{/privacy}","received_events_url":"https://api.github.com/users/iTaa/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":6,"state":"open","created_at":"2018-06-25T02:15:38Z","updated_at":"2018-07-20T01:17:25Z","due_on":"2018-07-11T07:00:00Z","closed_at":null},"comments":3,"created_at":"2018-06-29T09:55:09Z","updated_at":"2018-07-20T01:17:25Z","closed_at":"2018-07-20T01:17:25Z","author_association":"CONTRIBUTOR","body":"## 背景\r\n- `sqlalchemy`查询结果是一个`orm`的对象，在取到`orm`对象之后需要取出表对象的字段属性\r\n- 如果使用特定表字段作为属性取值的做法不通用\r\n\r\n## 步骤\r\n- 将对象中的`public`属性取出\r\n- 根据`getattr`获得对象的属性\r\n\r\n## 举例\r\n```python\r\n>>> class Table(object):\r\n        def __init__(self, a, b, c):\r\n            self._d = 12\r\n            self.a = a\r\n            self.b = b\r\n            self.c = c\r\n\r\n>>> table = Table(1,2,3)\r\n>>> get_obj_attr_dict(table)\r\n{'a': 1, 'b': 2, 'c': 3}\r\n```"}}
{"actor":{"display_login":"iTaa"}}