Skip to content

Instantly share code, notes, and snippets.

@tendstofortytwo
Last active December 14, 2017 08:05
Show Gist options
  • Save tendstofortytwo/c63124fa951423a3b4638664d7e3646b to your computer and use it in GitHub Desktop.
Save tendstofortytwo/c63124fa951423a3b4638664d7e3646b to your computer and use it in GitHub Desktop.
Origami-lib getTextArray example
import origami
# all memory/processor intensive work that is to be done only once (like loading models) goes here
# replace $TOKEN with your app token generated by web app
app = origami.register('$TOKEN')
@origami.crossdomain
@app.listen()
def concat():
## receiving the data
## let's say the webapp has 2 entries in Text Input Component with inputs given by user: 'ABC' and 'XYZ'
alltext = origami.getTextArray()
for text in alltext:
print text ## ABC
## XYZ
# must send something back to webapp, let's send original inputs for now
origami.sendTextArray(alltext)
return 'OK'
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment