Resources : http://bit.ly/SeqModelsResources
A gunshot.
"This is it", she thought
import requests | |
import pandas as pd | |
def get_weather_df(lat='40.7128',lon='-74.006',start_date='1979-01-01', end_date='2022-01-15'): | |
headers = { | |
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36', | |
'Origin': 'https://climate.northwestknowledge.net', | |
'Sec-Fetch-Site': 'cross-site', | |
'Sec-Fetch-Mode': 'cors', | |
'Sec-Fetch-Dest': 'empty', |
import requests, datetime, time | |
PINCODE, WAIT = '600096', 60 | |
def notify(available_sessions): | |
print("SESSIONS AVAILABLE :%r"%available_sessions) | |
while True: | |
resp = requests.get('https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/calendarByPin?pincode=600096&date=%s'%datetime.datetime.now().strftime("%d-%m-%Y")).json() | |
all_sessions = [(center['name'], session['date'], session['available_capacity']) for center in resp['centers'] for session in center['sessions'] if session['min_age_limit']==18] | |
available_sessions = [i for i in all_sessions if i[2]] |
// ==UserScript== | |
// @name Upstox Notifier | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://pro.upstox.com/trading | |
// @grant none | |
// ==/UserScript== |
import re | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
with open('/Users/vishalgupta/Downloads/WhatsApp Chat with MopHead.txt','r') as f: | |
backup_text = f.read() | |
matches = re.findall('\n([0-9]+[/][0-9]+[/][0-9]+, [0-9]+[:][0-9]+ [AP]M - [a-zA-Z ]+[:])',backup_text) | |
sender_df = pd.DataFrame([{'time':pd.to_datetime(row.split('-')[0].strip()),'sender':row.split('-')[1].strip().replace(':','')} for row in matches]) | |
sender_df.groupby('sender').time.hist(bins=30) | |
plt.show() |
""" | |
Note : This approach is an alternative to using the API for fetching instance info by | |
saving the webpages in ~/Downloads/ instead and using BeautifulSoup for parsing the data. | |
Go to https://codein.withgoogle.com/dashboard/task-instances/?sp-order=name&sp-my_tasks=false&sp-page_size=100 | |
Iterate over all pages (1, 2, 3...) and save them. | |
""" | |
from glob import glob | |
from bs4 import BeautifulSoup as soup | |
import pandas as pd |
all_rows = [] | |
for fname in glob("/Users/vishalgupta/Downloads/Task instances _ Google Code-in *.htm"): | |
with open(fname) as f: | |
cont = f.read() | |
s = soup(cont) | |
rows = s.select('md-table-container tbody tr') | |
for row in rows: | |
vals = [i.text.strip() for i in row.select('td') if i.text.strip()] |
all_rows = [] | |
for fname in glob("/Users/vishalgupta/Downloads/Task instances _ Google Code-in *.htm"): | |
with open(fname) as f: | |
cont = f.read() | |
s = soup(cont) | |
rows = s.select('md-table-container tbody tr') | |
for row in rows: | |
vals = [i.text.strip() for i in row.select('td') if i.text.strip()] |
Resources : http://bit.ly/SeqModelsResources
A gunshot.
"This is it", she thought
from selenium import webdriver,common | |
""" | |
How to Download Chrome Driver : | |
- Go to https://chromedriver.storage.googleapis.com/index.html?path=2.45/ | |
- Download and unzip webdriver for your OS | |
- Move the webdriver to a where it can be accessed by python. (Same directory or $PATH) | |
""" | |
try : |