• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

1.7K
Views
TypeError: el argumento debe ser un objeto similar a bytes o una cadena ASCII, no 'dict'

Recibo este error cuando estoy descifrando el mensaje encriptado. Obtuve el mensaje encriptado de la base de datos en las vistas de django como pw = donator.objects.filter(emai=email).values('passw') y pasé el objeto pw en la función decrypt_message(). La función decrypt_messag() es:

 def decrypt_message(encrypted_message,key): """ Decrypts an encrypted message """ f = Fernet(key) decrypted_message = f.decrypt(encrypted_message) return decrypted_message.decode()

El mensaje de error es:

 File "C:\Users\Neelesh Singh\workspace\BookHouse\donatorapp\views.py", line 129, in decrypt_message f = Fernet(key) File "C:\Users\Neelesh Singh\AppData\Local\Programs\Python\Python39\lib\site-packages\cryptography\fernet.py", line 37, in __init__ key = base64.urlsafe_b64decode(key) File "C:\Users\Neelesh Singh\AppData\Local\Programs\Python\Python39\lib\base64.py", line 131, in urlsafe_b64decode s = _bytes_from_decode_data(s) File "C:\Users\Neelesh Singh\AppData\Local\Programs\Python\Python39\lib\base64.py", line 45, in _bytes_from_decode_data raise TypeError("argument should be a bytes-like object or ASCII " TypeError: argument should be a bytes-like object or ASCII string, not 'dict'
about 3 years ago · Santiago Trujillo
1 answers
Answer question

0

Debe pasar el elemento asociado con passw a la función, por lo que:

 pws = donator.objects.filter(emai=email).values('passw') for pw in pws: # use pw['passw'], not pw ↓ decrypt_message(encrypted_message, pw['passw'] )
about 3 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error