SHARE
TWEET

Untitled

a guest Sep 18th, 2019 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2.  
  3. def read_word_list(file_path):
  4.     return open(file_path, "r").readlines()
  5.  
  6. def try_url(url):
  7.     r = requests.get(url=url)
  8.     return r.status_code
  9.  
  10. def log_response(message, file_to_write):
  11.     print message
  12.     f = open(file_to_write, "w+")
  13.     f.writelines(message)
  14.  
  15. def main():
  16.     base_url = "https://www.google.de"
  17.     word_list_file = "/home/phil/Schreibtisch/word_list.txt"
  18.     log_file = "/home/phil/Schreibtisch/log.txt"
  19.     endpoints = read_word_list(word_list_file)
  20.     for endpoint in endpoints:
  21.         url = base_url + "/" + endpoint.strip()
  22.         status = try_url(url)
  23.         log_response(url + " ---> " + str(status), log_file)
  24.  
  25. main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top