Skip to content

Instantly share code, notes, and snippets.

View afraz-khan's full-sized avatar
☁️
data is reality

Afraz Khan afraz-khan

☁️
data is reality
View GitHub Profile
@afraz-khan
afraz-khan / GENERATE_SECRET_KEY.md
Created January 31, 2025 14:46
Generate a Secret Key with Python

We use the python secrets module to generate a random password/key.

python3 -c "import secrets; print(secrets.token_urlsafe(32))"

@afraz-khan
afraz-khan / DISABLE_PYTHON_SSL_CA_VERIFICATION.md
Created February 5, 2025 16:04
Disable SSL Certificates verification in Python

Developers often encounter SSL certificate verification errors in Python when connecting to HTTPS endpoints. This can be frustrating, especially during local development. You can temporarily disable SSL certificate verification using the code below—just place it before the HTTPS connection in your script.

import ssl

try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    # Legacy Python that doesn't verify HTTPS certificates by default
 pass