Skip to content

Instantly share code, notes, and snippets.

@chrisalexander
chrisalexander / query.js
Created February 3, 2014 17:39
Food query non-hierarchical
importio.query({
"connectorGuids": [
"a64157e2-107c-49da-ae78-068d011575c9"
],
"input": {
"recipe": "chicken"
}
}, { "data": dataCallback, "done": doneCallback });
@chrisalexander
chrisalexander / results.json
Created February 3, 2014 17:40
Non-hierarchical results
[
{
"data": {
"recipe": "Stuffed chicken with Mediterranean vegetables recipe",
"link": "http://www.channel4.com/4food/recipes/tv-show/come-dine-with-me-recipes/series-10/stuffed-chicken-with-mediterranean-vegetables-recipe",
"image": "http://www.channel4.com/media/images/Channel4/4Food/ontv/come-dine/daytime-2014/stuffed-chicken_B6.png",
"image/_alt": "Stuffed chicken",
"image/_source": "/media/images/Channel4/4Food/ontv/come-dine/daytime-2014/stuffed-chicken_B6.png",
"link/_source": "/4food/recipes/tv-show/come-dine-with-me-recipes/series-10/stuffed-chicken-with-mediterranean-vegetables-recipe",
"link/_text": "Stuffed chicken with Mediterranean vegetables recipe"
@chrisalexander
chrisalexander / query.js
Created February 3, 2014 17:41
Hierarchical query example
importio.query({
"connectorGuids": [
"a64157e2-107c-49da-ae78-068d011575c9"
],
"input": {
"recipe": "chicken"
},
"asObjects": true
}, { "data": dataCallback, "done": doneCallback });
@chrisalexander
chrisalexander / results.json
Created February 3, 2014 17:42
Hierarchical query results
[
{
"data": {
"recipe": "Stuffed chicken with Mediterranean vegetables recipe",
"link": {
"_value": "http://www.channel4.com/4food/recipes/tv-show/come-dine-with-me-recipes/series-10/stuffed-chicken-with-mediterranean-vegetables-recipe",
"_text": "Stuffed chicken with Mediterranean vegetables recipe",
"_source": "/4food/recipes/tv-show/come-dine-with-me-recipes/series-10/stuffed-chicken-with-mediterranean-vegetables-recipe"
},
"image": {
@chrisalexander
chrisalexander / readme.md
Created February 17, 2014 11:00
#FloodHack Flood Flash source code

To use, simply get your import.io API key and user GUID from your account and put in the first to variables, then host the PHP script somewhere on the internet.

Then configure your Twilio SMS endpoint to point at the script, and send the number you configured an SMS.

@chrisalexander
chrisalexander / synchronous.py
Created March 3, 2014 18:30
Python synchronous example
print "Getting data with query 'python'"
data = get_data("python")
print data
@chrisalexander
chrisalexander / async.py
Created March 3, 2014 18:42
Async data example
def my_callback(data):
print "Data recieved!"
print data
print "Getting data with query 'python'"
get_data("python", my_callback)
print "Function call returned returned"
@chrisalexander
chrisalexander / async_query.py
Created March 3, 2014 19:06
Full python latch example
import logging, json, importio, latch
# Create an import.io client using a GUID and API key for authentication
client = importio.importio(userId="YOUR_USER_GUID", apiKey="YOUR_API_KEY")
# Once we have started the client and authenticated, we need to connect it to the server:
client.connect()
# We are doing three queries, so create a latch for those three queries
queryLatch = latch.latch(3)
'''
import.io client library - example code
This file is an example for integrating with import.io using the Python client library
Dependencies: Python 2.7, importio.py
@author: dev@import.io
@source: https://github.com/import-io/importio-client-libs/tree/master/python
'''
chris@import:~/python$ python example.py
Queries dispatched, now waiting for results
Got data!
Got data!
Got data!
Got data!
Got data!
Got data!
Got data!
Got data!