[Python] Shopee API request failed and give response "error_auth"

Discussão em 'Python' iniciado por Stack, Abril 11, 2025.

  1. Stack

    Stack Membro Participativo

    this is my first time asking in stackoverflow. I want to fetch data using Shopee API. I follow the documentation in Shopee but it always return "error_auth". How can I fix this ? Here is the code below :

    import hmac
    import time
    import requests
    import hashlib

    timest = int(time.time())
    host = "https://partner.shopeemobile.com"
    path = "/api/v2/shop/auth_partner"
    redirect_url = "http://localhost:3000"
    partner_id =
    partner_key = ""

    base_string = "%s%s%s"%(partner_id, path, timest)

    signature = hmac.new(bytes( partner_key, 'utf-8'), msg = bytes(base_string , 'utf-8'), digestmod = hashlib.sha256).hexdigest()

    url = host + path + "?partner_id=%s&timestamp=%s&sign=%s&redirect=%s"%(partner_id, timest, signature, redirect_url)


    And here is the respond :

    {
    "request_id": "5e82043c27318f70007e4aca894f1365",
    "error": "error_auth"
    }

    Continue reading...

Compartilhe esta Página