diff --git a/py/url-check-requests.py b/py/url-check-requests.py new file mode 100755 index 0000000..1024adc --- /dev/null +++ b/py/url-check-requests.py @@ -0,0 +1,7 @@ +#!/usr/bin/python3 +import requests + +url = "https://stats.oecd.org/" +resp = requests.get(url) + +print(resp.text) diff --git a/py/url-check-selenium.py b/py/url-check-selenium.py new file mode 100755 index 0000000..6a24654 --- /dev/null +++ b/py/url-check-selenium.py @@ -0,0 +1,11 @@ +#!/usr/bin/python3 +from selenium import webdriver + +url = "https://blog.headdesk.me" +options = webdriver.ChromeOptions() +options.add_argument('ignore-certificate-errors') + +driver = webdriver.Chrome(options=options) +driver.get(url) +driver.save_screenshot("site.png") +driver.close() diff --git a/py/url-check-urllib.py b/py/url-check-urllib.py new file mode 100755 index 0000000..241a1b0 --- /dev/null +++ b/py/url-check-urllib.py @@ -0,0 +1,6 @@ +#!/usr/bin/python3 +from urllib.request import urlopen +url = "https://stats.oecd.org/" +with urlopen(url) as response: + body = response.read() +print(body) diff --git a/py/url-check-urllib3.py b/py/url-check-urllib3.py new file mode 100755 index 0000000..7b8cdc4 --- /dev/null +++ b/py/url-check-urllib3.py @@ -0,0 +1,10 @@ +#!/usr/bin/python3 +import urllib3 +from urllib3 import Timeout + +urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) +http = urllib3.PoolManager(cert_reqs='CERT_NONE') +url = "https://stats.oecd.org/" +r = http.request('GET', url, timeout=Timeout(10)) + +print("statusCode: %s" % r.status)