From 4a33ea9d2c82c5fdcd29fc4f54fbb141c673b4d7 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Thu, 18 Jun 2020 10:52:00 +0200 Subject: Fix imports --- opendc/util/database.py | 4 ++-- setup.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/opendc/util/database.py b/opendc/util/database.py index 9b570d0d..20006ff2 100644 --- a/opendc/util/database.py +++ b/opendc/util/database.py @@ -4,7 +4,7 @@ import sys from datetime import datetime from pymongo import MongoClient from bson.json_util import loads, dumps, RELAXED_JSON_OPTIONS, CANONICAL_JSON_OPTIONS - +import urllib.parse #from mysql.connector.pooling import MySQLConnectionPool @@ -122,7 +122,7 @@ def fetchall(query, collection): results = [] cursor = prefabs_collection.find(query) for doc in cursor: - json_string = dumps(bson) #convert BSON representation to JSON + json_string = dumps(doc) #convert BSON representation to JSON json_obj = json.loads(json_string) #load as a JSON object #leave the id field in for now, we can use it later #json_obj.pop("_id") diff --git a/setup.py b/setup.py index 531df1c3..b8b9b18b 100644 --- a/setup.py +++ b/setup.py @@ -42,6 +42,7 @@ setup( 'flask-cors==3.0.8', 'pyasn1-modules==0.2.2', 'six==1.11.0', - 'pymongo==3.10.1' + 'pymongo==3.10.1', + 'bson==0.5.10' ], ) -- cgit v1.2.3