Skip to content

Instantly share code, notes, and snippets.

@tony19
Last active May 28, 2016 02:21
Show Gist options
  • Save tony19/18711889f7b04857548a3996bf5d0bbb to your computer and use it in GitHub Desktop.
Save tony19/18711889f7b04857548a3996bf5d0bbb to your computer and use it in GitHub Desktop.
Python Flask app that shows merging URL 'entry' parameters into array
from flask import Flask, request, jsonify
app = Flask(__name__)
@app.route('/api/test')
def test():
return jsonify(entries=request.args.getlist('entry'))
if __name__ == '__main__':
app.run()
# http://stackoverflow.com/a/37494577/6277151
# 1. Run `python get_entries.py`
# 2. Open browser to http://localhost:5000/api/test?tag=general_message&entry=One%20message&entry=to%20rule&entry=them%20all
# 3. Observe that it returns this string:
# {
# "entries": [
# "One message",
# "to rule",
# "them all"
# ]
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment