在为 EUIPO API 连接请求不记名令牌时如何解决 404 和未授权错误?

问题描述 投票:0回答:0

我一直在尝试连接到 EUIPO API,但似乎没有任何效果。这里的任何人都能够向 API 发出简单的请求吗?我正在尝试获取商标数据库的简单搜索结果。我将不胜感激任何帮助。

我已经成功地创建了一个应用程序访问权限并获得了一个 api 密钥和一个秘密,但似乎您需要创建第一个请求来获取不记名令牌(其他一切都是必需的)但我一直在请求时收到 404 或没有授权。我正在使用的指南可以在这里找到:

https://dev.euipo.europa.eu/faq

导入请求 导入 json

url = "https://auth.euipo.europa.eu/oidc/accessToken"

payload = {
    'client_id': 'my api key',
    'client_secret': 'my secret',
    'grant_type': 'client_credentials'
}

headers = {
     'Content-Type': 'application/x-www-form-urlencoded'
}

response = requests.post(url, data=payload, headers=headers)

# print the status code and raw response
print("Status Code:", response.status_code)
print("Response Text:", response.text)

上面的代码在 url 上返回 404,如果我更改为沙箱,则表示我未获得授权。 如果有人对此有更多信息,我将不胜感激

rest
© www.soinside.com 2019 - 2024. All rights reserved.