mirror of
https://github.com/NaiboWang/EasySpider.git
synced 2025-04-23 05:54:26 +08:00
Add service inovke
This commit is contained in:
parent
6c0becdf09
commit
5f0440c935
42
Examples/Sample Tasks/service_invoke.py
Normal file
42
Examples/Sample Tasks/service_invoke.py
Normal file
@ -0,0 +1,42 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from base64 import encode
|
||||
import json
|
||||
import os
|
||||
|
||||
|
||||
def queryService(id):
|
||||
with open("tasks/%d.json" % id, "r", encoding='utf-8') as f:
|
||||
service = json.loads(f.read())
|
||||
return service
|
||||
|
||||
|
||||
def invokeService(id, data):
|
||||
service = queryService(id)
|
||||
try:
|
||||
service["links"] = data["urlList_0"]
|
||||
except:
|
||||
pass
|
||||
for key, value in data.items():
|
||||
for i in range(len(service["inputParameters"])):
|
||||
if key == service["inputParameters"][i]["name"]: # 能调用
|
||||
nodeId = int(service["inputParameters"][i]["nodeId"])
|
||||
node = service["graph"][nodeId]
|
||||
if node["option"] == 1:
|
||||
node["parameters"]["links"] = value
|
||||
elif node["option"] == 4:
|
||||
node["parameters"]["value"] = value
|
||||
elif node["option"] == 8 and node["parameters"]["loopType"] == 0:
|
||||
# print("loopType 0", value)
|
||||
node["parameters"]["exitCount"] = int(value)
|
||||
# print(node)
|
||||
elif node["option"] == 8:
|
||||
node["parameters"]["textList"] = value
|
||||
break
|
||||
|
||||
count = len(os.listdir("tasks")) + 1
|
||||
service["id"] = count # 修改id
|
||||
print(count)
|
||||
with open("execution_instances/%d.json" % count, "w", encoding='utf-8') as f:
|
||||
s = json.dumps(service, ensure_ascii=False)
|
||||
f.write(s)
|
||||
return count
|
@ -0,0 +1,5 @@
|
||||
Due to the complex security settings of MacOS, the issue of being unable to open software due to the "unverified developer" message may occur upon the first attempt to open the software. Please refer to the following GitHub document to see how to open software and perform tasks on your MacOS version:
|
||||
|
||||
https://github.com/NaiboWang/EasySpider/wiki/MacOS-Guide
|
||||
|
||||
File access permissions must be granted, microphone permissions are not necessary at all, and the author is not sure why microphone permissions are being requested, so they can be declined.
|
@ -1,9 +1,3 @@
|
||||
Due to the complex security settings of MacOS, the issue of being unable to open software due to the "unverified developer" message may occur upon the first attempt to open the software. Please refer to the following GitHub document to see how to open software and perform tasks on your MacOS version:
|
||||
|
||||
https://github.com/NaiboWang/EasySpider/wiki/MacOS-Guide
|
||||
|
||||
File access permissions must be granted, microphone permissions are not necessary at all, and the author is not sure why microphone permissions are being requested, so they can be declined.
|
||||
|
||||
Official Site: https://github.com/NaiboWang/EasySpider
|
||||
|
||||
Welcome to promote this software to other friends.
|
||||
|
3
Releases/EasySpider_MacOS_all_arch/初次打开请看这个.txt
Normal file
3
Releases/EasySpider_MacOS_all_arch/初次打开请看这个.txt
Normal file
@ -0,0 +1,3 @@
|
||||
由于MacOS复杂的安全性设置,初次打开软件会显示未验证开发者从而不允许打开的问题,请参考以下视频来查看MacOS版本如何打开软件和执行任务:https://www.bilibili.com/video/BV1WL411h71r
|
||||
|
||||
文件访问权限必须给,麦克风权限完全用不到,作者也不清楚为什么会需要麦克风,因此可以拒绝。
|
@ -1,9 +1,5 @@
|
||||
欢迎将软件宣传给更多需要的朋友!
|
||||
|
||||
由于MacOS复杂的安全性设置,初次打开软件会显示未验证开发者从而不允许打开的问题,请参考以下视频来查看MacOS版本如何打开软件和执行任务:https://www.bilibili.com/video/BV1WL411h71r
|
||||
|
||||
文件访问权限必须给,麦克风权限完全用不到,作者也不清楚为什么会需要麦克风,因此可以拒绝。
|
||||
|
||||
官方网址: https://github.com/NaiboWang/EasySpider
|
||||
|
||||
支持Windows 10 x64及以上版本。
|
||||
|
Loading…
x
Reference in New Issue
Block a user