Add push.py
This commit is contained in:
parent
31ad3d782e
commit
073bf3a662
15
push.py
Normal file
15
push.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
from pymongo import MongoClient
|
||||||
|
from config import *
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
|
def push(document):
|
||||||
|
client = MongoClient(CONNECTION_STRING)
|
||||||
|
database = client[DATABASE]
|
||||||
|
collection = database[COLLECTION]
|
||||||
|
collection.insert_one(document)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
push(json.loads(sys.argv[1]))
|
||||||
|
|
Loading…
Reference in a new issue