For my assignment, I had to program an application that deals with common problems and come up with a solution for it.
Since websites are always hosted on a server, I decided to write a program that checks if the website is online and tells the user which status code the response was.
I also investigated the current and emerging trends in web development to see if my program was using the latest technology.
While AI is rather new, it has become very popular over the last couple of years and is very helpful for debugging and generating sample code.
Iโve personally used it to debug issues that Google wouldnโt have been able to resolve.
Iโve used it for very difficult issues where I couldnโt determine the cause.
It has cut the time I spent debugging in half.
Iโve also used it for suggestions and sample code.
You must understand how to code as you need to modify and change it to work with your specific project in mind.
There is GitHub Copilot, which is built into VS Code and Visual Studio.
Progressive applications include offline access, push notifications, and super-fast loading.
People are more likely to spend time on a website longer if it is a progressive application.
Serverless Architecture includes many services like AWS or Microsoft Azure that allow you to deploy website code and projects without having to configure the server manually, which was common a couple of years ago.
WebAssembly, while hard to understand, is very useful because it provides a massive speed increase compared to JavaScript.
WebAssembly is many times faster than JavaScript, making it perfect for applications that need to be fast.
Web3 and Decentralized Applications are very new and quite complex.
They involve blockchains, similar to how Bitcoin works, providing security and user control.
Token-based authentication and smart contracts are also very popular.
https://www.hostinger.com/tutorials/web-development-trends
https://graphicdesignjunction.com/2025/01/future-of-web-development-trends/
Not being able to tell if a website is offline or misconfigured is a very common problem that I decided to solve by writing this application.
Being able to tell helps with web development and allows the developer to access information they usually wouldnโt have.
To solve this problem, I wrote a Python script that checks if a domain name is online or offline.
It uses the requests library to get the response and tells the user how long it took to respond, the status code, and whether it is online or offline.
I also validated and checked the URLs to make sure they are correctly formatted.
I chose Python because every Linux server comes with it by default.
I used the requests framework, which allows you to get the status code and responses from a website easily.
This was perfect for my solution.
I also used the validators framework to validate the string format.
Lastly, I used argparse to handle command line arguments and give feedback to the user.
While researching how to develop this application, I looked at how others wrote their code and how they checked if a website was online.
I improved on it and made it more advanced and easier to use.
I used the following resources:
https://stackoverflow.com/questions/1949318/checking-if-a-website-is-up-via-python
https://learningactors.com/learn-how-to-create-a-website-status-checker-in-python/
I decided to choose Python for this project because Python is included on all servers by default, while NodeJS is not.
This means it would run on any machine running Unix or Linux, saving the developer time from having to install and set up a complete NodeJS installation.
The most popular Linux distribution is Ubuntu, and Python 3 comes with Ubuntu by default.
Iโm more comfortable with Python, and itโs easier to write small scripts compared to JavaScript.
I chose requests because it is the easiest library in Python to use for this purpose.
Other libraries I could have used were HTTP.client, socket, or aiohttp.
I didnโt choose socket as it doesnโt provide HTTP status and only checks via DNS.
Aiohttp is too complicated to implement, and since it was only one URL, I didnโt need it to be asynchronous.
Lastly, HTTP.client is quite limited.
https://stackoverflow.com/questions/11057926/what-are-the-list-of-os-that-havepython-preinstalled-and-which-versions
https://unix.stackexchange.com/questions/24802/on-which-unix-distributions-ispython-installed-as-part-of-the-default-install
https://askubuntu.com/questions/1396920/does-ubuntu-20-04-come-with-the-pythonstandard-library
https://www.speakeasy.com/blog/python-http-clients-requests-vs-httpx-vs-aiohttp
https://docs.aiohttp.org/en/stable/client_reference.html
When creating and designing this program, I had to consider the ethical and technical issues of creating a program that checks if a website is online.
The following possible issues arose:
Ethical Issues
- Privacy: The library I used to request information could unintentionally gather IP addresses, headers, and cookies.
- Permissions: Sometimes the owner of a server doesnโt want the server to be pinged, so that could be considered a violation of permission.
- Straining: If the web server is small, it could easily be brought down by many people using this application at once, unintentionally taking down the server.
- Terms of Service: It could be a violation of the terms of service to connect and request the data this application needs.
Technical Issues
- Incorrect information: The application might incorrectly assume the website is offline or online when it isnโt.
- Bans and triggering firewalls: While my program was written to request information only once, constant requests could lead to thousands of requests and result in the IP address being banned.
https://www.forskningsetikk.no/en/guidelines/social-sciences-and-humanities/a-guide-to-internet-research-ethics/
https://dev.to/manageengineapm/challenges-in-website-monitoring-48en
When designing the application, I initially had a more complicated idea.
I was thinking about doing a DNS-level check to see if there are A records and if it can connect to the A record.
I learned I only needed to use the requests library to gather information, then use if statements for the status codes and tell the user the result of connecting to the server.
My ability to plan and design a program has improved while developing and implementing my ideas.
I now think about the simplest and easiest way to accomplish a task and plan better by considering the issues Iโm dealing with.
What could I have done differently in the future?
- I would make the application handle multiple URLs using threading.
- I could encrypt the information from the program, decrypt it, load it back into the program, and show users what was stored in status.txt.
- I could add a command line argument that tells you specific things about the server, such as the current IP address.
- I considered adding a GUI using Tkinter or GTK, but due to time constraints and how soon the assignment was due, I couldnโt implement it.
- Also, having a GUI wouldnโt make much sense if itโs just checking one URL.
Installation and Program Documentation
You first need to download the application and put the source code into a local folder.
Itโs just the main.py script, and you will need to set up a virtual environment and install all the dependencies and libraries.
I used the Linux subsystem for Windows.
The commands to install the dependencies and virtual environment are the following:
python -m venv websitechecker
Then we activate the virtual environment using the following command:
source venv/bin/activate
We then install the requirements using the text file with the libraries in it, so there is no need to install them one by one:
pip install -r requirements.txt
To use the application, you need to run the script with arguments.
Use the --url argument and include a valid domain name in the format of http:// or https://.
Example:
main.py --url https://jessicaamy.com
If you donโt use a command line argument and just run the application, it will run a loop and keep asking you for a domain to check if that domain is online.
0 responses to “Blog prototype server checker.”