Python

Python posts, videos, courses, and more

Ruan Bekker

3 weeks ago

View Post

Weather Monitoring with Grafana and the DHT22 Sensor

In this tutorial, we will connect the DHT22 sensor to the Raspberry Pi Zero via the GPIO pins to measure temperature and humidity and visualize it with Grafana. Then we will write a Python exporter for prometheus to expose our metrics so that we can visualize it in Grafana. The Endgoal The Hardware This is how the sensor looks...
Weather Monitoring with Grafana and the DHT22 Sensor
4
Select One:

Ruan Bekker

3 weeks ago

View Post

AWS S3 KMS and Python for Secrets Management

So your application need to store secrets and you are looking for a home for them. In this tutorial we will see how we can use Python, S3 and KMS to build our own solution for managing secrets. There is SSM and Secrets Manager that probably does a better job, but my mind got curious :D High Level Goal From a High-Level we want t...
AWS S3 KMS and Python for Secrets Management
3
Select One:

Ruan Bekker

1 month ago

View Post

Using Python RQ for Task Queues in Python

This is a getting started on python-rq tutorial and I will demonstrate how to work with asynchronous tasks using python redis queue (python-rq). What will we be doing We want a client to submit 1000's of jobs in a non-blocking asynchronous fashion, and then we will have workers which will consume these jobs from our redis queue,...
Using Python RQ for Task Queues in Python
4
Select One:

Ruan Bekker

1 month ago

View Post

Gitlab CICD Pipeline to Deploy your Python Flask API with Postgres on Heroku

Today we will build a Restful API using Python Flask, SQLAlchemy using Postgres as our Database, testing using Python Unittest, a CI/CD Pipeline on Gitlab, and Deployment to Heroku. Should you be interested in setting up a Custom Gitlab Runner on Your Own Server for Gitlab CI have a look at the embedded post. Heroku If you don'...
Gitlab CICD Pipeline to Deploy your Python Flask API with Postgres on Heroku
3
Select One:

Ruan Bekker

1 month ago

View Post

Encryption using PyCrypto in Python

While I'm learning a lot about encryption at the moment, I wanted to test out encryption with the PyCrypto module in Python using the Advanced Encryption Standard (AES) Symmetric Block Cipher. Installing PyCrypto: $ pip install pycrypto --user PyCrypto Example: Our AES Key needs to be either 16, 24 or 32 bytes long and our Init...
Encryption using PyCrypto in Python
2
Select One:

Ruan Bekker

2 months ago

View Post

Improve MySQL Write Performance Using Batch Writes

I am no DBA, but I got curious when I noticed sluggish write performance on a mysql database, and I remembered somewhere that you should always use batch writes over sequential writes. So I decided to test it out, using a python script and a mysql server. What will we be doing I wrote a python script that writes 100,000 records...
Improve MySQL Write Performance Using Batch Writes
2
Select One:

Ruan Bekker

2 months ago

View Post

Sending Slack Messages with Python

In this post I will demonstrate how to send messages to slack using python based on the status of an event. We will keep it basic, that when something is down or up, it should send a slack message with the status, message, color and embed your grafana dashboard links inside the alert (or any links that you would like). Create a...
Sending Slack Messages with Python
2
Select One:

Amine Dev

2 years ago

View Post

Python Classes/Objects

Python Classes/ObjectsPython is an object oriented programming language.Almost everything in Python is an object, with its properties and methods.A Class is like an object constructor, or a "blueprint" for creating objects.Create a ClassTo create a class, use the keyword class:
Python Classes/Objects
Select One:

Amine Dev

2 years ago

View Post

Python : methods of list objects

 List in pythonA list is a collection which is ordered and changeable. In Python lists are written with square brackets.
Python : methods of list objects
Select One:

Wael Manai

2 years ago

View Post

Getting a user’s country, currency, timezone or language from their IP address

In many projects in the past, when I’ve had to use a Geo IP API service to look up a user’s IP address, it was usually for one of several reasons — getting the user’s country (for geo-locking certain features, or defaulting to certain sections or categories of the site), defaulting a user’s created account to a certain currency,...
Getting a user’s country, currency, timezone or language from their IP address
Select One:

Loading More Content

Back to DevDojo