How to hide a password in a Python script

How to hide a password in a Python script

Python, System Administration
Background Python is widely used for web scraping and APIs, dealing with databases, sending emails, and other tasks that may involve credentials, like a username or password. Luckily, there are several ways to hide a password in a Python script, as well as to store multiple passwords for many users if needed. In this post, we'll talk about three such packages - keyring, passlib, and cryptography, with a focus on the first two. How to hide a password in a Python script with keyring keyring is an easy-to-use package that works by allowing you to store a password in your operating system's credential store. It's great in that it can work across multiple different operating systems. To get started, just use pip to install: [code] pip install keyring [/code] Next,…
Read More
All About Python Dictionaries

All About Python Dictionaries

Python
In this article, we will explore Python dictionaries. For my previous tutorials on Python data structures, please see the below links. Lists List Comprehensions Sets What are Python dictionaries? A dictionary is one of Python's primary data structures. In essence, a dictionary (also shortened as dict) is a collection of key-value pairs, similar to an actual dictionary (like the one pictured above). When you look up a word in a dictionary, you find a corresponding definition. Similarly, in a Python dictionary, each key has a corresponding value. In dictionaries, one key can have only one value. However, the value can be anything from a single number or character, to lists, tuples, other dictionaries, or even functions! Creating a Dictionary Dictionaries can be created several ways. The most straightforward way is…
Read More