Last active
June 13, 2017 18:50
-
-
Save vidul-nikolaev-petrov/9952349b26efa257780c to your computer and use it in GitHub Desktop.
Checks Website Urls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import multiprocessing | |
import requests | |
Host = 'http://www.example.com' | |
Username = 'YOUR USERNAME' | |
Password = 'YOUR PASSWORD' | |
Urls = ('about', 'admin', 'newticket' | |
'prefs', 'search', 'report', | |
'report', 'report/1', 'report/2',) | |
def assert_200(url, username, password): | |
url = Host + '/' + url | |
auth = requests.auth.HTTPBasicAuth(username, password) | |
resp = requests.get(url, auth=auth) | |
assert resp.status_code == 200 | |
print(resp.status_code, url) | |
procs = [] | |
for url in Urls: | |
process = multiprocessing.Process( | |
target=assert_200, | |
args=(url, Username, Password)) | |
procs.append(process) | |
process.start() | |
for p in procs: | |
p.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment