gpt4 book ai didi

google-cloud-platform - 如何使用 Python 使用 Google Data Prep API

转载 作者:行者123 更新时间:2023-12-04 01:38:02 25 4
gpt4 key购买 nike

Google 刚刚发布了新的 API。链接是here .

我想知道在这种情况下主机是什么,因为他们使用 example.com 并使用 端口 3005

我也在关注this article .但这不提供示例代码。

最佳答案

如果您打开 Dataprep 控制台并导航至 Settings > Access Tokens你可以点击Generate New Token .这将调出 token ,您可以将其复制到剪贴板,还有关于使用哪个基本端点的说明:


enter image description here

然后,单击特定食谱(见下图)将修改浏览器 URL 为以下形式:

https://clouddataprep.com/flows/<FLOW_ID>?recipe=<RECIPE_ID>&tab=recipe

enter image description here

我们将保留 RECIPE_ID>这样我们的请求正文 ( dataprep-request.json) 就是这样的:

{
"wrangledDataset": {
"id": <RECIPE_ID>
}
}

然后,我们可以调用 JobGroups Create :

curl https://api.clouddataprep.com/v4/jobGroups \
-X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d @dataprep-request.json

响应将类似于此输出(我使用 python3 -m json.tool 来漂亮地打印 JSON):

{
"sessionId": "<SESSION_ID>",
"reason": "JobStarted",
"jobGraph": {
"vertices": [
4479390,
4479391
],
"edges": [
{
"source": 4479390,
"target": 4479391
}
]
},
"id": <JOB_GROUP_ID>,
"jobs": {
"data": [
{
"id": 4479390
},
{
"id": 4479391
}
]
}
}

现在,检索到 <JOB_GROUP_ID>我们可以使用 JobGroups Get 终点:

curl https://api.clouddataprep.com/v4/jobGroups/<JOB_GROUP_ID> \
-H "Authorization: Bearer $TOKEN"

响应:

{
"id": <JOB_GROUP_ID>,
"name": null,
"description": null,
"ranfrom": "ui",
"ranfor": "recipe",
"status": "InProgress",
"profilingEnabled": true,
"runParameterReferenceDate": "2019-12-08T21:49:33.000Z",
"createdAt": "2019-12-08T21:49:35.000Z",
"updatedAt": "2019-12-08T21:49:36.000Z",
"workspace": {
"id": REDACTED
},
"creator": {
"id": REDACTED
},
"updater": {
"id": REDACTED
},
"snapshot": {
"id": 4226057
},
"wrangledDataset": {
"id": <RECIPE_ID>
},
"flowRun": null
}

关于google-cloud-platform - 如何使用 Python 使用 Google Data Prep API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58736743/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com