Skip to content

Automating more stuff at work because I'm lazy. This time it's URL testing. Gets CSV data, tests links, formats response codes in output file.

License

Notifications You must be signed in to change notification settings

michaelfromyeg/pylink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pylink

Another Python project to automate stuff I'm too lazy to do by hand. Take a list of URLs, and generate a report of their status (tailored to UBC ECE).

made-with-python

MIT license

Requirements

  • Python
  • Data, in the form a csv file

Example CSV data:

Website
https://ece.ubc.ca/~fvogt/
https://ece.ubc.ca/~ivanov/

Virtual environment quickstart (for Windows):

pip install virtualenv
virtualenv env
source ./env/Scripts/active
pip install -r requirements.txt
pip freeze > requirements.txt

Usage

Run python link.py -i <input file> -o <output file>, where 'input file' is the name of a CSV file containing URLs under ece.ubc.ca.

Example

Here's an example console call:

cd ./src && python link.py -i two.csv -o test.csv

And here's an example of the program's output (as a Markdown table):

Origin Result Status
https://ece.ubc.ca/~fvogt/ 403 @ https://ece.ubc.ca/~fvogt/ Site is secured; I don't have access
https://ece.ubc.ca/~ivanov/ 302 @ https://ece.ubc.ca/~ivanov/; and finally 200 @ https://ece.ubc.ca/faculty/andre-ivanov Site redirects to ece.ubc.ca
https://ece.ubc.ca/~dany/ 200 @ https://ece.ubc.ca/~dany/ Site is hosted here
https://ece.ubc.ca/~faizalk/ 200 @ https://ece.ubc.ca/~faizalk/ Site is hosted here
https://ece.ubc.ca/~farzadk/ 200 @ https://ece.ubc.ca/~farzadk/ Site is hosted here
https://ece.ubc.ca/~jamesc/ 200 @ https://ece.ubc.ca/~jamesc/ Site is hosted here
https://ece.ubc.ca/~lyon/ 200 @ https://ece.ubc.ca/~lyon/ Site is hosted here
https://ece.ubc.ca/~mkarimib/ 200 @ https://ece.ubc.ca/~mkarimib/ Site is hosted here
https://ece.ubc.ca/~rfoist/ 200 @ https://ece.ubc.ca/~rfoist/ Site is hosted here

As CSV:

Origin,Result,Status
https://ece.ubc.ca/~fvogt/,403 @ https://ece.ubc.ca/~fvogt/,Site is secured; I don't have access
https://ece.ubc.ca/~ivanov/,302 @ https://ece.ubc.ca/~ivanov/; and finally 200 @ https://ece.ubc.ca/faculty/andre-ivanov,Site redirects to ece.ubc.ca
https://ece.ubc.ca/~dany/,200 @ https://ece.ubc.ca/~dany/,Site is hosted here
https://ece.ubc.ca/~faizalk/,200 @ https://ece.ubc.ca/~faizalk/,Site is hosted here
https://ece.ubc.ca/~farzadk/,200 @ https://ece.ubc.ca/~farzadk/,Site is hosted here
https://ece.ubc.ca/~jamesc/,200 @ https://ece.ubc.ca/~jamesc/,Site is hosted here
https://ece.ubc.ca/~lyon/,200 @ https://ece.ubc.ca/~lyon/,Site is hosted here
https://ece.ubc.ca/~mkarimib/,200 @ https://ece.ubc.ca/~mkarimib/,Site is hosted here
https://ece.ubc.ca/~rfoist/,200 @ https://ece.ubc.ca/~rfoist/,Site is hosted here

And finally, formatted in Excel:

Formatted output

Future

Handle status codes better.

About

Automating more stuff at work because I'm lazy. This time it's URL testing. Gets CSV data, tests links, formats response codes in output file.

Topics

Resources

License

Stars

Watchers

Forks