aboutsummaryrefslogtreecommitdiff
path: root/source/mongodb.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2012-05-03 21:49:52 +0200
committercedricbonhomme <devnull@localhost>2012-05-03 21:49:52 +0200
commit10c8465e4ff3914b1d7f444b743ff1d3c4911d98 (patch)
tree34d6b833b17bb24f6050d42b2b6769025dbe6af2 /source/mongodb.py
parentTests detection of feed links in HTML page. (diff)
downloadnewspipe-10c8465e4ff3914b1d7f444b743ff1d3c4911d98.tar.gz
newspipe-10c8465e4ff3914b1d7f444b743ff1d3c4911d98.tar.bz2
newspipe-10c8465e4ff3914b1d7f444b743ff1d3c4911d98.zip
Distant MongoDB connection working (tested with AlwaysData).
Diffstat (limited to 'source/mongodb.py')
-rw-r--r--source/mongodb.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/mongodb.py b/source/mongodb.py
index 727d8183..fd605465 100644
--- a/source/mongodb.py
+++ b/source/mongodb.py
@@ -15,12 +15,14 @@ from operator import itemgetter, attrgetter
class Articles(object):
"""
"""
- def __init__(self, url='localhost', port=27017):
+ def __init__(self, url='localhost', port=27017, db_name="pyaggr3g470r", user="", password=""):
"""
Instantiates the connection.
"""
self.connection = pymongo.connection.Connection(url, port)
- self.db = self.connection.pyaggr3g470r
+ self.db = pymongo.database.Database(self.connection, db_name)
+ self.db.authenticate(user, password)
+ self.db = self.connection[db_name]
def add_collection(self, new_collection):
"""
bgstack15