NEW: python url checkers
This commit is contained in:
parent
0160ca24e7
commit
f0f88dc4d6
7
py/url-check-requests.py
Executable file
7
py/url-check-requests.py
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
import requests
|
||||||
|
|
||||||
|
url = "https://stats.oecd.org/"
|
||||||
|
resp = requests.get(url)
|
||||||
|
|
||||||
|
print(resp.text)
|
11
py/url-check-selenium.py
Executable file
11
py/url-check-selenium.py
Executable file
@ -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()
|
6
py/url-check-urllib.py
Executable file
6
py/url-check-urllib.py
Executable file
@ -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)
|
10
py/url-check-urllib3.py
Executable file
10
py/url-check-urllib3.py
Executable file
@ -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)
|
Loading…
Reference in New Issue
Block a user