How to encrypt PDF as Password Protected File in Python

Here I am going to show you an example how to encrypt PDF to make it password protected using PyPDF2 module in Python programming language. I am not going to show you how to create a new PDF file in this example and I am going to read the existing PDF file and making this PDF file password protected. It is a good idea to make the PDF password protected when you want to send some sensitive data into the PDF file over the network, such as, email or you…

Continue

How to watermark Image with Text using Python

Introduction In this tutorial I am going to show you an example on how to watermark image with text using Python. You might have seen somewhere online portal or social network portals that some images are watermarked, because the owners of the images want to prevent misuse of the images. Here I am going to show you how you can place the text watermark on different places, for example: right bottom, center, on top of the image. I will also show how to change the color of the watermarked text…

Continue

Add Images to Word File using Python

Here I am going to show an example how you can add images to word file in Python programming language. Generally you write headings, paragraphs, etc. to describe an event or something in the word file. To explain better pictorially about the same thing you need to insert or add images. python-docx is a Python library for creating and updating Microsoft Word (.docx) files. I am going to use Python based python-docx module to insert images into the word (docx) file.

Continue

How to convert Video (MP4/AVI) Clips to GIF in Python

I am going to show you how to convert video (MP4/AVI) clips to gif in Python programming language. Recently I was trying online to convert an avi format video file to gif and I found that there are some limitations: you cannot upload more than 50 or 100 MB file; you need to register or login to the web site to convert your video file. And my requirement was not fulfilled. So I wrote this example. The source code which I am going to show you can be found in…

Continue

How to display Date Time in Different Formats in Python

Here I am going to discuss how to display date time in different formats using Python programming language. Python datetime module supplies classes for manipulating dates and times. Date and time objects may be categorized as “aware” or “naive” depending on whether or not they include timezone information. An aware object, such as time zone and daylight saving time information, can locate itself relative to other aware objects. An aware object represents a specific moment in time that is not open to interpretation.

Continue

How to return Different Response Formats (JSON, XML) in Flask REST API

Here I am going to show you how to return different response formats (content negotiation) from Flask REST API. The default response format you receive from the REST API is JSON (JavaScript Object Notation). Now for some requirements you may need to return XML format from your REST API. Then this example may help you how to do it. I will show you example on HTTP GET and POST method. Content negotiation refers to mechanisms defined as a part of HTTP that make it possible to serve different versions of…

Continue

Django 3, MySQL REST API Angular 10 CRUD Example

Here in this tutorial I am going to explain how to integrate Django REST API with Angular framework. CRUD stands for Create, Read, Update and Delete operations which will be performed from UI (User Interface) using Angular framework and on server side Django framework and MySQL server are used. The Angular framework will be used in this example for representing the UI (User Interface) where end users will perform CRUD operations.

Continue

How to merge multiple CSV files into one using Python

In this tutorial I am going to show you how to merge multiple CSV files into one in Python. I am using two CSV files for this example. You may need to merge multiple CSV files into one in some situations for your business requirements. Your different CSV files might have some common headers amongst them and when you merge those CSV files you want to put unique headers for the final CSV file. Under each header you will write values from different CSV files. If there is no value…

Continue

Single and Multiple Files Upload Example in Django REST API

Most of the applications require at least one file needs to be upload for a reason, such as, for uploading bulk data or processing file data for business requirement. This example will show you how to upload single or multiple files using Django REST framework. REST is an acronym that stands for Representation State Transfer which works on http/https protocol. It is light weight and delivers data very fast. I am assuming you have a basic knowledge on Python and Django REST framework before you proceed further down. I am…

Continue

Single or Multiple Files Upload Example in Django Framework

In your application or project there is always a requirement for uploading a file data. This file data could be in a specific format depending on your requirement. Here I am going to explain you how you can upload single or multiple files in your python based Django framework. I am assuming you have a basic knowledge on Python and Django framework before you proceed further. I am also going to show you how to implement CSRF token for uploading files.

Continue