This file contains 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
import datetime | |
import pymongo | |
database = pymongo.MongoClient("mongodb://localhost:27017") # Mongodb connection | |
db = database.maindb # Database | |
posts = db.items # Collection within a database | |
# A schema equivalent function that returns the object | |
def user_details(name, dob): |
This file contains 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
import requests | |
import bs4 as bs | |
headers = { | |
'cache-control': 'no-cache', | |
'user-agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" | |
} | |
a = requests.get("https://time.is", headers=headers) | |
soup = bs.BeautifulSoup(a.text,'lxml') |