-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlib.py
41 lines (31 loc) · 944 Bytes
/
lib.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from pymongo import MongoClient
import logging
import time
import random
test_client = MongoClient(
host='humor1.vip.gatech.edu',
port=3306,
username='comedian_monologues',
password='BlENteRsEWROmbERaInG',
authSource='hgp_comedian_monologues',
authMechanism='SCRAM-SHA-1'
)
def insert_example():
logger = logging.getLogger(__name__)
youtube_table = \
test_client['hgp_comedian_monologues']['youtube_monologues']
logger.info('Content before example insert')
for record in youtube_table.find():
print(record)
youtube_table.insert_one({
'data': f'insert example {str(random.randint(1, 1000))}',
'timestamp': int(round(time.time() * 1000))
})
logger.info('Content after example insert')
for record in youtube_table.find():
print(record)
if __name__ == "__main__":
logging.basicConfig(
level=logging.INFO
)
insert_example()