[Python] Python and micro Python Incompatibility

Discussão em 'Python' iniciado por Stack, Março 23, 2025.

  1. Stack

    Stack Membro Participativo

    I am experiencing an issue with signature verification while making API requests from an ESP32 device running MicroPython. I am consistently receiving a 'signature is wrong' error from the server.

    The same code is running on my laptop successfully.

    Here's a summary of my setup and troubleshooting steps:

    Request Type: GET. Signature Algorithm: HMAC-SHA256 Parameter Sorting: Parameters are sorted by ASCII value, concatenated with '=', and joined with '&'. Message Format: GetApi(f"{EF_URL}{EF_PATH}",EF_KEY,EF_SECRET,{'sn':EF_SN}) Generated Signature: verified against online calculator. I have performed the following troubleshooting steps:

    Verified that the message format aligns with the API documentation. Confirmed that the parameters are being sorted correctly. Ensured that all strings are encoded with UTF-8. Verified that the timestamp is generated correctly. Used multiple online HMAC-SHA256 calculators to verify the generated signature, and the signature generated by my code matches the online calculators. Despite these steps, the API continues to reject the signature.

    Continue reading...

Compartilhe esta Página