refactor: get subset dict with wanted keys
This commit is contained in:
parent
7addcd5b36
commit
974597db5b
1 changed files with 1 additions and 4 deletions
5
app.py
5
app.py
|
@ -22,10 +22,7 @@ def home():
|
|||
return threads
|
||||
|
||||
def clean_status(status):
|
||||
clean = {}
|
||||
clean['content'] = status['content']
|
||||
clean['created_at'] = status['created_at']
|
||||
clean['url'] = status['url']
|
||||
clean = {k: status[k] for k in {'content', 'created_at', 'url'}}
|
||||
if 'descendants' in status:
|
||||
descendants = status['descendants']
|
||||
clean['descendants_count'] = len(descendants)
|
||||
|
|
Loading…
Reference in a new issue