forked from czeng07/alexas-kitchen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecipeStuff.py
executable file
·46 lines (31 loc) · 1.15 KB
/
recipeStuff.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import json
from pymongo import MongoClient
import unirest
connect = MongoClient("mongodb://caren:[email protected]:27017,cluster0-shard-00-01-yeacn.mongodb.net:27017,cluster0-shard-00-02-yeacn.mongodb.net:27017/admin?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin")
db = connect["avail-ingredients"]
pantry = db['pantry']
options = db['recommended']
current = db['currentrec']
searched = db['searched']
currentingredients = db['currentingredients']
currentinstructions = db['currentinstructions']
cStep = db['currentstep']
#get an array of all of the strings of the steps
def getStepsString(inst):
steps = {}
stepArray = []
for doc in inst.find():
steps[doc['Step Number']] = doc['Step']
length = 0
for a in steps:
length += 1
for x in xrange(1, length+1):
stepArray.append(steps[x])
return stepArray
def recipeSelection(options):
ops = []
for doc in options.find():
ops.append(doc['Title'] + ":::" + str(doc['id']))
return ops
#print getStepsString(currentinstructions)
#print recipeSelection(options)