Add MongoDB integration and JSON download functionality
- Created a new script `update_mongodb.py` to handle downloading JSON data from APIs and loading it into MongoDB. - Implemented functions for downloading JSON files, loading data into MongoDB collections, and managing updates. - Updated `update_json.py` to instantiate the `dbmongo` class for MongoDB operations. - Enhanced logging for better tracking of the download and load processes.
This commit is contained in:
+1
-1
@@ -10,7 +10,6 @@ import db.sql
|
||||
import logs.Logger
|
||||
from db.functions import settype, dbmongo
|
||||
from datetime import datetime
|
||||
import json_downloader
|
||||
import json
|
||||
|
||||
response = None
|
||||
@@ -108,6 +107,7 @@ def main() -> int:
|
||||
|
||||
config_options = settings.config.Config(ROOTDIR)
|
||||
options = config_options.config_options
|
||||
mongo_updater = dbmongo(options) # Create an instance of dbmongo
|
||||
dbtype, apitype = options["dbtype"], options["apitype"]
|
||||
dbs = settype(dbtype, apitype, options)
|
||||
dbclass, dbengine, apiengine = dbs.dbclass, dbs.dbengine, dbs.apiengine
|
||||
|
||||
Reference in New Issue
Block a user