Skip to content

Instantly share code, notes, and snippets.

View ynevet's full-sized avatar
:octocat:
Taking part in building the next world

Yair Nevet ynevet

:octocat:
Taking part in building the next world
View GitHub Profile
@ynevet
ynevet / fail-fast-pattern.py
Last active March 1, 2022 16:29
Fail fast and loudly example
def _get_remote_config_value(self, path: str) -> str:
try:
_, resp = self._config_client.kv.get(path)
val = resp['Value'].decode()
return val
except Exception as e:
print(f'Fail to get remote configuration for key = {path}')
raise e
@ynevet
ynevet / fail-fast-pattern.py
Last active March 1, 2022 17:06
silent-fail-anti-pattern
def load_config():
try:
default_url = 'localhost:8080'
url = config.get('url', default_url)
return url
except:
log.warning('failed to load config key: url')
return default_url
@ynevet
ynevet / main.py
Last active September 22, 2023 10:55
Web scraping using python and popular libs
from selenium import webdriver
from bs4 import BeautifulSoup
import pandas as pd
import html
import datetime
def initialize_driver():
options = webdriver.ChromeOptions()
options.add_argument('--headless=new')