Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- def read_word_list(file_path):
- return open(file_path, "r").readlines()
- def try_url(url):
- r = requests.get(url=url)
- return r.status_code
- def log_response(message, file_to_write):
- print message
- f = open(file_to_write, "w+")
- f.writelines(message)
- def main():
- base_url = "https://www.google.de"
- word_list_file = "/home/phil/Schreibtisch/word_list.txt"
- log_file = "/home/phil/Schreibtisch/log.txt"
- endpoints = read_word_list(word_list_file)
- for endpoint in endpoints:
- url = base_url + "/" + endpoint.strip()
- status = try_url(url)
- log_response(url + " ---> " + str(status), log_file)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement