|
|
@ -22,7 +22,6 @@ def get_topstories():
|
|
|
|
return r.json()
|
|
|
|
return r.json()
|
|
|
|
|
|
|
|
|
|
|
|
async def get_story(session, story_id):
|
|
|
|
async def get_story(session, story_id):
|
|
|
|
#story_url = f'https://hacker-news.firebaseio.com/v0/item/{story_id}.json'
|
|
|
|
|
|
|
|
async with session.get(f'https://hacker-news.firebaseio.com/v0/item/{story_id}.json') as resp:
|
|
|
|
async with session.get(f'https://hacker-news.firebaseio.com/v0/item/{story_id}.json') as resp:
|
|
|
|
s = await resp.json() #requests.get(story_url).json()
|
|
|
|
s = await resp.json() #requests.get(story_url).json()
|
|
|
|
return Story(s['id'],
|
|
|
|
return Story(s['id'],
|
|
|
@ -30,7 +29,7 @@ async def get_story(session, story_id):
|
|
|
|
s['url'] if 'url' in s else 'No URL',
|
|
|
|
s['url'] if 'url' in s else 'No URL',
|
|
|
|
s['by'],
|
|
|
|
s['by'],
|
|
|
|
s['score'],
|
|
|
|
s['score'],
|
|
|
|
len(s['kids']) if 'kids' in s else 0, False)
|
|
|
|
s['descendants'] if 'descendants' in s else 0, False)
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
ts = get_topstories()
|
|
|
|
ts = get_topstories()
|
|
|
|