Skip to content

Instantly share code, notes, and snippets.

View athyk's full-sized avatar
🎯
Focusing on a custom hosting panel

Athy K athyk

🎯
Focusing on a custom hosting panel
View GitHub Profile
@athyk
athyk / main.py
Last active February 3, 2023 11:41
pymongo basic schema
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):
@athyk
athyk / main.py
Created February 27, 2021 09:35
Python get the current event in Time.is
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')