Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
added implementation directions to README and borrowed Mongo connecti…
Browse files Browse the repository at this point in the history
…on process from scraper.
  • Loading branch information
ttavenner committed Mar 20, 2014
1 parent 67dac95 commit 763cf34
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
5 changes: 2 additions & 3 deletions API.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pymongo import MongoClient
import mongolab
from bson.objectid import ObjectId
import json
from flask import Flask, Response, url_for
Expand All @@ -8,8 +8,7 @@
app.config['TESTING'] = True
app.debug = True

client = MongoClient('mongodb://cfa:[email protected]:33639/healthdata')
db = client.healthdata
db = mongolab.connect()


@app.route('/')
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The API for the Open Health Inspection app.

This API provides an interface to a MongoDB containing data from the Virginia Department of Health on inspections of food service facilities. Data is returned via JSON. To get the current list of routes make a call to the root URL.

It can be implemented very simply using Flask with [WSGI on Apache](http://flask.pocoo.org/docs/deploying/mod_wsgi/), or very simply on [Heroku with Gunicorn](https://devcenter.heroku.com/articles/getting-started-with-python).

Routes implemented:

* /vendors - provides a complete list of food service vendors
Expand Down
6 changes: 6 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import json


def load():
with open('config.json','r') as f:
return json.loads(f.read())
7 changes: 7 additions & 0 deletions mongolab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import config
from pymongo import MongoClient

def connect():
c = config.load()
client = MongoClient(c["db_uri"])
return client[c["db_name"]]

0 comments on commit 763cf34

Please sign in to comment.