Skip to content

Instantly share code, notes, and snippets.

View shamilbi's full-sized avatar
🇺🇦

Shamil Bikineyev shamilbi

🇺🇦
View GitHub Profile
@shamilbi
shamilbi / selenium_get_page_source.py
Last active November 12, 2022 16:51
selenium: get page source
from selenium import webdriver
from selenium.webdriver.common.proxy import Proxy, ProxyType
URL = "https://www.ozon.ru/category/telefony-i-smart-chasy-15501/?sorting=rating"
# proxy list: https://freeproxylists.net/ru.html
proxy_addr = '93.123.226.23'
proxy_port = '81'
prox = Proxy()
@shamilbi
shamilbi / task1_unittest.py
Created November 11, 2022 16:59
jl.pyshop.ru: Задание 1. Разработать функцию определения счета в игре (test)
import unittest
from task1 import get_score, INITIAL_STAMP, generate_game, ScoreException
def extract_scores(d: dict):
return ((d2 := d['score'])['home'], d2['away'])
class TestStringMethods(unittest.TestCase):
def setUp(self):
@shamilbi
shamilbi / task1.py
Last active November 11, 2022 17:00
jl.pyshop.ru: Задание 1. Разработать функцию определения счета в игре
class ScoreException(Exception):
pass
def get_score(game_stamps, offset):
'''
Takes list of game's stamps and time offset for which returns the scores for the home and away teams.
Please pay attention to that for some offsets the game_stamps list may not contain scores.
'''
def extract_scores(d: dict):