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 streamlit as st | |
from notion_api import * | |
import os | |
page_name = os.path.basename(__file__).replace(".py", "") | |
st.set_page_config( | |
page_title = page_name | |
) |
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 streamlit as st | |
import requests | |
NOTION_KEY = st.secrets["NOTION_KEY"] | |
BASE_PAGE_ID = "10f16f5e14c18095863ccadd6d9140de" | |
def get_child_pages(page_id, token): | |
url = f"https://api.notion.com/v1/blocks/{page_id}/children" | |
headers = { | |
"Authorization": f"Bearer {token}", |
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
#from pandas_datareader import data as web | |
def download_data(tickers, start_date, end_date): | |
for ticker in tickers: | |
try: | |
print(f'Downloading {ticker}') | |
# Download data from Yahoo | |
temp_df = web.DataReader(ticker, 'yahoo', start_date, end_date) | |
# Create a column with only the ticker symbol | |
temp_df["Ticker"] = ticker |
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 pygame | |
from random import randint, choice | |
# RGB colours | |
BLACK = (0, 0,0) | |
WHITE = (255, 255, 255) | |
GREEN = (44, 205, 23) | |
RED = (216, 10, 0) | |
BLUE = (27, 64, 255) | |
PURPLE = (121, 0, 234) |
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 pandas as pd | |
import openpyxl as pxl | |
from openpyxl.utils.dataframe import dataframe_to_rows | |
# Name of the workbook we'll be using | |
filename = 'test_wb.xlsx' | |
# For demo purposes, create a new 1-sheet workbook | |
# DataFrame to be inserted in the first worksheet | |
firstMockDF = pd.DataFrame({ |
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
# Imports | |
# (...) | |
# selenium set up | |
# (...) | |
# scrape dictionary of characters and output as pickle | |
# (...) | |
# Running dataframe to collect operator data into |
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
# Imports | |
# (...) | |
# selenium set up | |
# (...) | |
# scrape dictionary of characters and output as pickle | |
# (...) | |
# op_dict is the dictionary with all characters and their URLs |
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 pickle | |
from bs4 import BeautifulSoup | |
req = requests.get("https://gamepress.gg/arknights/tools/interactive-operator-list") | |
soup = BeautifulSoup(req.content, "lxml") | |
# Get all the table cells (<td>) with information about the operators | |
op_list = soup.find_all("td", class_="operator-cell") | |
op_dict = {} |
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
# imports, driver variable set up and loading a character page | |
# (...) | |
def get_stats_per_level(num_levels): | |
for i in range(num_levels): | |
# Code to read stats (see previous code snippet) | |
# (...) | |
# Get the arrow to increase operator level |
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
# imports, driver variable set up and loading a character page | |
# (...) | |
# First thing we need before reading data: decrease the operator level (even if it is already at the lowest level possible) | |
# Otherwise some stats may be missing | |
decrease_level_button = driver.find_element_by_class_name("fa-arrow-left") | |
decrease_level_button.click() | |
# Read the opreator class | |
operator_class = driver.find_element_by_class_name("profession-title").text.strip() |
NewerOlder