Created
August 4, 2019 18:54
-
-
Save jplsightm/439880572d3c3df6985c5f0ab4117024 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mongo_objs(conn_str, database, tests=[lambda x: x.document_count({})]): | |
client = pymongo.MongoClient(conn_str) | |
db = client[database] | |
sslog = db.sslog | |
cycle = db.cycle | |
sslog_results = {} | |
cycle_results = {} | |
for test in tests: | |
try: | |
sslog_results[test.__name__] = test(sslog) | |
except TypeError as e: | |
sslog_results[test.__name__] = e | |
try: | |
cycle_results[test.__name__] = test(cycle) | |
except TypeError as e: | |
cycle_results[test.__name__] = e | |
return client, db, sslog, cycle, sslog_results, cycle_results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment