Categories
Programming

Python requests get status code

In this article, we will provide code examples on how you can get the status code of a page via the Python requests module. Python requests get status code The python requests module is straight forward in it’s usage, with just 3 simple lines, you can get a status code from any page. The python […]

Categories
Programming

Create a Python dictionary and add key value pairs

In this short python tutorial we will take a look at how to create a dictionary in Python. Dictionaries are pretty fast, and they do not allow duplicate keys, so that can be handy if used right. In this tutorial we will be creating the ‘cyberweapons’ dictionary, and we will be adding the threat level […]

Categories
Programming

How to get IP from hostname in Python + code

If you want to get the IP from a hostname in Python, you can use the socket module which is already included in Python. The next thing which you will need, is a variable that will hold the hostname which you want to request. The second variable is the address variable. The IPHOLDER variable will […]

Categories
Programming

Functions in Python: How to define and use them

If you want to use Functions in Python, you will need to define them first. Python is very straight forward in that. For example, we want to create the function ‘Cyberwarzone’, and once the ‘Cyberwarzone’ function is called, it has to print ‘This is cyberwarzone’. The code for this function looks like this: Cyberwarzone():   […]

Categories
Programming

How to download a page in Python

If you want to download a page with Python, you will be suprised on how many ways you are able to do so. In this post I have collected two methods which will allow you to download a HTML page directly with Python. The first one is the WGET function, this function is very direct. […]