31 lines
702 B
Python
31 lines
702 B
Python
from pathlib import Path
|
||
import sys
|
||
|
||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||
|
||
from openx_sdk import OpenXSigner
|
||
|
||
|
||
# 只演示签名生成,不依赖 requests,也不会发送网络请求。
|
||
signer = OpenXSigner(
|
||
access_key="",
|
||
secret_key="",
|
||
)
|
||
|
||
# 固定 timestamp 和 nonce 时,输出应与 curl 示例中的 signature 完全一致。
|
||
signed = signer.sign(
|
||
query={
|
||
"comId": "100787681",
|
||
"accountId": "861533101421002919",
|
||
"startDate": "2025-07-01",
|
||
"endDate": "2025-07-30",
|
||
"pageNum": "1",
|
||
"pageSize": "20"
|
||
},
|
||
timestamp="1780889319",
|
||
nonce="9fb5235a-175c-4d24-adde-aca39ad1e7bc",
|
||
)
|
||
|
||
print(signed.signature)
|
||
print(signed.headers)
|