Skip to content

Instantly share code, notes, and snippets.

@mjg123 mjg123/

Last active Apr 10, 2018
What would you like to do?
Example fn code to query the OsloBysykkel API
import json
import urllib2
import sys
input = json.loads(''.join(sys.stdin.readlines()))['body']
if input == "":
input = "167"
input = input.strip()
opener = urllib2.build_opener()
opener.addheaders = [('Client-Identifier', 'f416cc3951533fc385acd670a0d0172d')]
content ='').read()
bikestations = json.loads(content)
output = {}
for b in bikestations['stations']:
if str(b['id']) == input:
output = b
print(json.dumps({'body': json.dumps(output)}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.