Skip to content

Instantly share code, notes, and snippets.

@jvmaia
Last active November 16, 2020 14:33
Show Gist options
  • Save jvmaia/18979cddcdaf4858ed561c414fec60b2 to your computer and use it in GitHub Desktop.
Save jvmaia/18979cddcdaf4858ed561c414fec60b2 to your computer and use it in GitHub Desktop.
from flask import Flask
app = Flask(__name__)
sample_list = list(i for i in range(9))
def runner():
while True:
for item in sample_list:
yield item
runner_instance = runner()
@app.route('/')
def index():
next_item = next(runner_instance)
return dict(next_item=next_item)
if __name__ == '__main__':
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment