I want to pass a stdin [file which have lines] to requests.get
For example,
I want to check status code of below websites.
http://google.com
http://bing.com
http://twitter.com
Below is a correct code for checking status code of a single website. Which command is "test.py --url http://google.com"
Now I want to check status code of multiple websites from an input file. E.g: "test.py --website url.txt"
def run(arguments):
if arguments.url is None or arguments.url.strip() == '':
target = get_input("Enter URL : ")
else:
target = (arguments.url)
var = requests.get(target, headers={"Referer":"test"}, verify=False)
print(var.status_code, "ok")
Thanks