Skip to content

Instantly share code, notes, and snippets.

View nclsbayona's full-sized avatar
🎯
Focusing

nclsbayona nclsbayona

🎯
Focusing
View GitHub Profile
@timothycrosley
timothycrosley / write_once.py
Last active March 31, 2021 20:37
Write once run every where
"""An example of writing an API to scrape hacker news once, and then enabling usage everywhere"""
import hug
import requests
@hug.local()
@hug.cli()
@hug.get()
def top_post(section: hug.types.one_of(('news', 'newest', 'show'))='news'):
"""Returns the top post from the provided section"""