Friday, October 7, 2022

[ Website status check ]

Using Requests, one of the most popular HTTP libraries for Python, I created a program that shows you the status of a website. I needed a similar tool for project I did where we had to check a list of URLs whether there is a site hosted or there is not. The task was simple but it gave me the idea for the program. See the screenshot below. In it I am giving you a very short example how my program works in Windows PowerShell:

In this example I have tried four URLs. Two returned me an OK status, which means the website is present and operational. One replied with Not Found. This indicates that there is no website hosted on the given URL, but the address is available for registration. The last one is an URL to a non existing website and my program says exactly this: Website Does Not Exist.

I have included many more HTTP status codes in my program, so it can return more replies from a given URL address.

If you have any questions, you are welcome to contact me using the form on the right side. I am available for collaboration with you also if you have similar project or need a program like this to check websites status or availability. You can send me a message using the contact form on my blog.

Check this video to see how you can get information or answers from Internet using the same Requests library and Python.

Tuesday, September 20, 2022

[ Email validation using Regular Expression ]


The module Regular Expression in Python provides a way to match patterns and I am using it to create my own validator for inputted email addresses. I have spent some time over the pattern that checks an email address and I created a string that is very useful in detecting whether a given email is valid or invalid. It is far from perfect, as I have seen the same string to occupies few lines of code when developed by companies like Google for example, but mine is also effective in catching a lot of fake email addresses or even strings that are not an email address at all. It can be used in web forms where Python code can be implemented in background.

Here is my Regular Expression pattern to validate an email address:

r"^[a-z0-9]+\.?[a-z0-9_]+\.?[a-z0-9]+@[a-z0-9\-]+\.?[a-z0-9\-]+\.[a-z]+$"

It can successfully detect most of the valid email addresses, including those using a dot . in the email name part. I have not included all the allowed by the convention special symbols as by my opinion they are rare in use by common users but same symbols could be easily added to the expression.

My code can also successfully detect many cases of invalid email addresses or attempts by the user to input something only to bypass the usually required field of the email address in various web or other forms.

I will not stop adding further improvements to this code so it will become better in the future. If you have questions or just want to say something about this code, you can use the contact form on the right. I am open to any kind of collaboration as well.

Wednesday, September 14, 2022

[ Calculator ]

In this video I am making a basic calculator program, using Python, that can perform a lot of mathematical operations.



[ Getting information from the Internet ]

In this video I am going to show you how to extract some information from the Internet using a Python code and the popular library Requests.



Monday, July 11, 2022

[ Wonderful journey ]

From the very first lines of code, usually greeting the world with 'Hello, world' all the way to creating GUI based software applications, these are the steps of learning a programming language. I am not an exception and started my journey with Python like this.

Why Python? Well first of all this is a very fast programming language and is friendly when it comes to learning it. It is practical and with it could be created a lot of things. I love writing small but useful applications, some of them using command line interface, others with a graphical interface. Also I love little games and they too could easily be developed using only Python. I also work with HTML and CSS, and they can be used with Python for web projects and more.

Last but not least I have growing interest in machine learning and artificial intelligence that also can benefit from Python as a programming language. And that is the future!

Python is fun!