I hereby claim:
- I am wasi0013 on github.
- I am wasi0013 (https://keybase.io/wasi0013) on keybase.
- I have a public key ASCAGYNlyVRTqJo6mqNbusXrz5U2eWcFuYYLhCB4EkhYfAo
To claim this, I am signing this object:
| from abc import ABC, abstractmethod | |
| class Polygon(ABC): | |
| @abstractmethod | |
| def area(self): | |
| pass | |
| @abstractmethod | |
| def perimeter(self): |
I hereby claim:
To claim this, I am signing this object:
| import requests_html | |
| def http2_enabled(url): | |
| """ | |
| scrape https://tools.keycdn.com/http2-test to find http 2/0 support of the given domain url | |
| """ | |
| url = url.replace("https://", "").replace("http://", "") | |
| session = requests_html.HTMLSession() | |
| response = session.get("https://tools.keycdn.com/http2-test") |
| import requests_html | |
| def unoptimized_images(url): | |
| """ | |
| find unoptimized images in a webpage | |
| :param url: webpage_url | |
| :return : tuple of image_count in int, images list of dict | |
| """ | |
| session = requests_html.HTMLSession() | |
| response = session.get(url) | |
| images = [] |
| import requests_html | |
| def crawl(base_url): | |
| broken_links = [] | |
| session = requests_html.HTMLSession() | |
| try: | |
| r = session.get(base_url) | |
| except: | |
| broken_links = [base_url] | |
| return broken_links |
| import requests | |
| filename = "logo.png" | |
| document_url = "https://wasi0013.files.wordpress.com/2018/11/my_website_logo_half_circle_green-e1546027650125.png" | |
| with open(filename, 'wb') as f: | |
| f.write(requests.get(document_url).content) |
| import requests | |
| chunk_size = 4096 | |
| filename = "logo.png" | |
| document_url = "https://wasi0013.files.wordpress.com/2018/11/my_website_logo_half_circle_green-e1546027650125.png" | |
| with requests.get(document_url, stream=True) as r: | |
| with open(filename, 'wb') as f: | |
| for chunk in r.iter_content(chunk_size): | |
| if chunk: | |
| f.write(chunk) |
| import requests | |
| chunk_size = 4096 | |
| filename = "logo.png" | |
| document_url = "https://wasi0013.files.wordpress.com/2018/11/my_website_logo_half_circle_green-e1546027650125.png" | |
| headers = { | |
| "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36", | |
| "Connection": "keep-alive", | |
| } | |
| s = requests.Session() | |
| cookie = requests.cookies.create_cookie('COOKIE_NAME','COOKIE_VALUE') |
| from selenium import webdriver | |
| import requests | |
| username = "Your Username" | |
| password = "Your Password" | |
| driver = webdriver.Chrome() | |
| # authenticate using username, password | |
| login_url = "https://your.target_website.com/login/" | |
| driver.get(login_url) |
| import json | |
| import time | |
| from pyvirtualdisplay import Display | |
| from selenium import webdriver | |
| document_url = "https://www.adobe.com/content/dam/acom/en/accessibility/products/acrobat/pdfs/acrobat-x-accessibility-checker.pdf" | |
| download_dir = "/path/to/dir/" | |
| # setup a virtual display using pyvirtualdisplay | |
| display = Display(visible=0, size=(1768, 1368)) |