refactor: get subset dict with wanted keys

This commit is contained in:
Ayo Ayco 2024-04-19 20:11:04 +02:00
parent 7addcd5b36
commit 974597db5b

5
app.py
View file

@ -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)