admin管理员组文章数量:1377521
I'm trying to call this API and am constantly getting a 401 error. Not sure what more I need to do to get it working. I've tried running with just HASH, and with a multitude of different libraries, but can't get the authorization to kick over. Really any help pointing out my error would be greatly appreciated.
import datetime
import random
import pandas as pd
from requests_oauthlib import OAuth1
CONSUMER_KEY = "123456789123"
CONSUMER_SECRET = "12345678901234"
ACCESS_TOKEN = "1234567890123456789"
TOKEN_SECRET = "1234567890123456789"
ACCOUNT_ID = "1234567"
API_URL = ";
HTTP_METHOD = "GET"
timestamp = str(int(datetime.datetime.utcnow().timestamp()))
nonce = ''.join(random.choices('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', k=11))
auth = OAuth1(
CONSUMER_KEY,
client_secret=CONSUMER_SECRET,
resource_owner_key=ACCESS_TOKEN,
resource_owner_secret=TOKEN_SECRET,
signature_method="HMAC-SHA256",
signature_type="auth_header"
)
headers = {
"Content-Type": "application/json",
"Accept": "application/json"
}
response = requests.get(API_URL, auth=auth, headers=headers)
print(f"{response.status_code}")
if response.status_code == 200:
data = response.json()
df = pd.DataFrame(data.get("items", []))
print(df)
else:
print(response.text)
本文标签: pythonNetSuite REST ServicesCannot validate authorizationStack Overflow
版权声明:本文标题:python - NetSuite REST Services - Cannot validate authorization - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744431428a2605965.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论