-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11.list_official_workflow_templates.py
More file actions
85 lines (71 loc) · 2.64 KB
/
11.list_official_workflow_templates.py
File metadata and controls
85 lines (71 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
"""
Description:
Returns a paginated list of official workflow templates, sorted by creation time.
Documentation:
https://www.browseract.com/reception/integrations/api-workflow
curl -X GET 'https://api.browseract.com/v2/workflow/list-official-workflow-templates?keyword=&page=1&limit=10' -H 'Authorization: Bearer app-abcdefghijklmn'
"""
import traceback
import requests
def main():
# API Key Required for API Call, generated from: https://www.browseract.com/reception/integrations
authorization = "app-abcdefghijklmn"
# Search keyword (optional)
keyword = ""
# Page number (minimum: 1, default: 1)
page = 1
# Number of items per page (minimum: 1, maximum: 500, default: 1)
limit = 10
try:
headers = {
"Authorization": f"Bearer {authorization}"
}
# Build query parameters
params = {
"page": page,
"limit": limit
}
# Add keyword if provided
if keyword:
params["keyword"] = keyword
api_url = "https://api.browseract.com/v2/workflow/list-official-workflow-templates"
response = requests.get(
api_url, headers=headers, params=params, timeout=30
)
if response.status_code == 200:
# success example:
# {'page': 1, 'limit': 10, 'items': [], 'total_pages': 0, 'total_count': 0}
# success example with data: Please refer to the bottom of this file
json = response.json()
total = json['total_count']
current = len(json['items'])
print(f"api-call-ok: total records num:{total} current page records num:{current}\n\n", json)
else:
# error example:
# {'code': 401, 'msg': 'Invalid authorization', 'data': None, 'ts': 1759917250113, 'time': '2025-10-08 09:54:10', 'traceId': 'bcdef'}
print(f"api-call-error: status={response.status_code}", response.json())
except Exception:
error = traceback.format_exc()
print(f"run-error: {error}")
if __name__ == "__main__":
main()
"""
success example:
{
'page': 1,
'limit': 10,
'items': [{
'templateId': '16217357109956214',
'name': 'E-commerce Product Scraper',
'recommendDesc': 'Scrape product information from e-commerce websites',
'detailUrl': 'https://www.browseract.com/template/16217357109956214'
}, {
'templateId': '16217357109956215',
'name': 'Social Media Data Collector',
'recommendDesc': 'Collect data from social media platforms',
'detailUrl': 'https://www.browseract.com/template/16217357109956215'
}],
'total_pages': 1,
'total_count': 2
}
"""