analitics

Pages

Monday, November 27, 2023

Python 3.10.12 : My colab get images from imdb.com by the name - part 040.

Transformers provides thousands of pretrained models to perform tasks on different modalities such as text, vision, and audio.
You find more on my Colab Github repo.

Python 3.13.0a1 : How to use PyOTP for Microsoft Authenticator.

PyOTP is a Python library for generating and verifying one-time passwords. It can be used to implement two-factor (2FA) or multi-factor (MFA) authentication methods in web applications and in other systems that require users to log in.
Read more on this official webpage.
Install with pip tool and use this source code:
import pyotp

# Generare secret pentru utilizator
secret = pyotp.random_base32()

# Generare URL pentru codul QR
uri = pyotp.totp.TOTP(secret).provisioning_uri(name="UtilizatorExemplu", issuer_name="NumeServer")

# Exemplu de folosire a URI-ului într-o aplicație web sau pentru a genera un cod QR
print("Scanati urmatorul QR code in aplicatia Microsoft Authenticator:")
print(uri)
I run the python script:
python test_001.py
Scanati urmatorul QR code in aplicatia Microsoft Authenticator:
otpauth://totp/NumeServer:UtilizatorExemplu?secret=SPZICPQHAMWOIYCAZEHXZTPQDXEXZSWL&issuer=NumeServer
I used the uri output with one online tool to generate this QR image code and I tested with the aplication.
The account is added with NumeServer and UtilizatorExemplu.

Python 3.10.12 : My colab get images from imdb.com by the name - part 039.

You can use gspread and google-auth to get data from a spreadsheet from google drive and use it.
The colab notebook can be found on my colab repo on Github.
from google.colab import auth
auth.authenticate_user()

import gspread
from google.auth import default
creds, _ = default()

gc = gspread.authorize(creds)

# Open the spreadsheet by name
spreadsheet = gc.open('fiecare_saptamana')

# Choose a worksheet from the spreadsheet
worksheet = spreadsheet.get_worksheet(0)  # 0 represents the index of the first worksheet

# Get and print the data
data = worksheet.get_all_values()

#uncoment this line to print data sau add more source code to parse data
#print(data)

#the result will be 
#[['noreply@projects.blender.org', '437', 'notifications@github.com',  ...