python-logo-requests-standard-library

How to perform HTTP requests with python – Part 1: The standard Library

HTTP is the protocol used by the World Wide Web, that’s why being able to interact with it programmatically is essential: scraping a web page, communicating with a service APIs, or even simply downloading a file, are all tasks based on this interaction. Python makes such operations very easy: some useful functions are already provided in the standard library, and for more complex tasks it’s possible (and even recommended) to use the external requests module. In this first article of the series we will focus on the built-in modules. We will use python3 and mostly work inside the python interactive shell: the needed libraries will be imported only once to avoid repetitions.

In this tutorial you will learn:

  • How to perform HTTP requests with python3 and the urllib.request library
  • How to work with server responses
  • How to download a file using the urlopen or the urlretrieve functions

Read more

python-logo-requests-requests-library

How to perform HTTP requests with python – Part 2 – The request Library

In the previous article we saw how to perform basic HTTP requests using the python3 standard library. When requests become more complex, or we just want to use less code, and we don’t mind adding a dependency to our project, it’s possible (and sometimes even recommended) to use the external requests module. The library, which adopted the “HTTP for Humans” motto, will be the focus of this article.

In this tutorial you will learn:

  • How to perform HTTP requests with python3 and the ‘requests’ library
  • How to manage server responses
  • How to work with sessions

Read more

jq-logo

How to parse a json file from Linux command line using jq

The JSON (JavaScript Object Notation) format is widely used to represent data structures, and is frequently used to exchange data between different layers of an application, or by the use of API calls. We probably know how to interact with json-formatted data with the most used programming languages such as parsing JSON with python, but what if we need to interact with it from the command line, or in a bash script? In this article we will see how we can accomplish such a task by using the jq utility and we will learn its basic usage.

In this tutorial you will learn:

  • How to install jq in the most used Linux distributions or compile it from source
  • How to use jq to parse json-formatted data
  • How to combine filters using “,” and “|”
  • How to use the length, keys, has and map functions

Read more

How to install Python in Ubuntu 18.04 Bionic Beaver Linux

Objective

Python 3 comes pre-installed as a default python interpreter for Ubuntu 18.04 desktop and server.

However, on other minimal Ubuntu 18.04 installations, eg. docker, python is missing and needs to be installed manually. The following guide will provide you with information on how to install Python in Ubuntu 18.04 Bionic Beaver Linux.

Operating System and Software Versions

  • Operating System: – Ubuntu 18.04 Bionic Beaver

Requirements

Privileged access to your Ubuntu System as root or via sudo command is required.

Conventions

Read more

install numpy python 2 - ubuntu 18.04 Bionic beaver

Install Numpy on Ubuntu 18.04 Bionic Beaver Linux

Objective

The objective is to install Numpy on Ubuntu 18.04 Bionic Beaver Linux.

Operating System and Software Versions

  • Operating System: – Ubuntu 18.04 Bionic Beaver Linux
  • Software: – Python 2 & Python 3

Requirements

Privileged access to your Ubuntu System as root or via sudo command is required.

Conventions

Read more

How to install PIP on Ubuntu 18.04 Bionic Beaver

Objective

The objective is to PIP the python package management system on Ubuntu 18.04 Bionic beaver

Operating System and Software Versions

  • Operating System: – Ubuntu 18.04 Bionic beaver

Requirements

Privileged access to your Ubuntu System as root or via sudo command is required.

Conventions

Read more

Install Python 2 on Ubuntu 18.04 Bionic Beaver Linux

Objective

Python version 3 is now the default python interpreter on Ubuntu 18.04 Desktop or Server release. However, if you need to install the older Python 2 version you can do that with a single apt command.

Operating System and Software Versions

  • Operating System: – Ubuntu 18.04 Bionic Beaver

Requirements

Privileged access to your Ubuntu System as root or via sudo command is required.

Conventions

Read more

PyCharm 3D creation suite on Ubuntu 20.04 Focal Fossa

How to install PyCharm on Ubuntu 20.04 Linux Desktop

In this tutorial we will be installing PyCharm on Ubuntu 20.04 Focal Fossa Desktop.

WHAT IS PYCHARM?
PyCharm is an integrated development environment (IDE) used in computer programming, specifically for the Python language. It provides code analysis, a graphical debugger, an integrated unit tester, integration with version control systems (VCSes), and supports web development with Django as well as Data Science with Anaconda. Reference: https://en.wikipedia.org/wiki/PyCharm

In this tutorial you will learn:

Read more

How to switch between alternative Python Versions

Ubuntu 20.04 Python version switch manager

The objective of this tutorial is to provide the reader with an easy to follow way of switching between alternative Python versions on Ubuntu 20.04 Focal Fossa Desktop/Server.

In this tutorial you will learn:

  • How to check installed Python versions
  • How to switch between alternative Python versions

Read more

Install Python 2 on Ubuntu 20.04 Focal Fossa Linux

Install Python 2 on Ubuntu 20.04 Focal Fossa Linux

The Python 2 version is no longer a default Python version since Ubuntu 18.04. With a release of Ubuntu 20.04 the Python 2 on a default system installation has been also completely dropped hence you might encounter the following error when executing the python command:

Command 'python' not found

No despair, the Python 2 is not installed by default but it is still available for installation.

In this tutorial you will learn:

  • How to install Python 2
  • How to switch Python 2 as a default python interpreter

Read more