python - 使用python从netsuite获取和推送数据

标签 python rest wsdl netsuite

我有一个任务,我必须同时使用 python 脚本和 wsdl 在 netsuite 中获取数据和推送数据。

任何形式的示例脚本或学习链接形式的帮助都会有所帮助。

提前致谢

最佳答案

您可以为此目的使用 reSTLet。创建后,您可以使用 python 访问它。这是我从 netsuite 帮助中找到的示例代码。

import oauth2 as oauth
import requests
import time

url = "https://rest.netsuite.com/app/site/hosting/restlet.nl?script=992&deploy=1"
token = oauth.Token(key="080eefeb395df81902e18305540a97b5b3524b251772adf769f06e6f0d9dfde5", secret="451f28d17127a3dd427898c6b75546d30b5bd8c8d7e73e23028c497221196ae2")
consumer = oauth.Consumer(key="504ee7703e1871f22180441563ad9f01f3f18d67ecda580b0fae764ed7c4fd38", secret="b36d202caf62f889fbd8c306e633a5a1105c3767ba8fc15f2c8246c5f11e500c")

http_method = "GET"  
realm="ACCT123456"

params = {
    'oauth_version': "1.0",
    'oauth_nonce': oauth.generate_nonce(),
    'oauth_timestamp': str(int(time.time())),
    'oauth_token': token.key,
    'oauth_consumer_key': consumer.key
}

req = oauth.Request(method=http_method, url=url, parameters=params)
signature_method = oauth.SignatureMethod_HMAC_SHA1()
req.sign_request(signature_method, consumer, token)
header = req.to_header(realm)
headery = header['Authorization'].encode('ascii', 'ignore')
headerx = {"Authorization": headery, "Content-Type":"application/json"}
print(headerx)
conn = requests.get("https://rest.netsuite.com/app/site/hosting/restlet.nl?script=992&deploy=1",headers=headerx)
print(conn.text)

关于python - 使用python从netsuite获取和推送数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46314111/

相关文章:

python - 在不同机器上运行时,sqlalchemy 连接相同的凭据被拒绝

c# - 如何在请求中传递字符串列表?

wcf - 如何让 WCF 与此 Web 服务对话?

java - 使 WSDL 文件保持最新

java - Web服务,WSDL地址中的动态地址

JavaScript MD5 与 Python/Bash md5sum 不同

python - 如何在 Tkinter/TTK 中稍微移动标签中的文本?

python - pycairo 在 osx 上安装错误

php - 在 PHP 中解码查询字符串

node.js - 使用 node.js supertest 对 multipart/form-data 进行 POST