Skip to content

Commit c38c34b

Browse files
committed
loop
1 parent 92e1c01 commit c38c34b

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

bpmn_types.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323

2424
BPMN_MAPPINGS = {}
2525

26+
timeout = ClientTimeout(sock_connect=5)
27+
client_session = ClientSession(timeout=timeout)
2628

27-
client_session = ClientSession(loop=asyncio.get_event_loop(),timeout=ClientTimeout(sock_connect=5))
2829

2930
def bpmn_tag(tag):
3031
def wrap(object):
@@ -253,7 +254,13 @@ async def run_connector(self, variables, instance_id):
253254
)
254255

255256
# Check method and make request
256-
257+
async with aiohttp.ClientSession() as session:
258+
async with session.get('http://httpbin.org/get') as resp:
259+
print(resp.status)
260+
print(await resp.text())
261+
print(await resp.text())
262+
print("test")
263+
return
257264
if method := self.connector_fields["input_variables"].get("method") or "GET":
258265
if method == "POST":
259266
call_function = client_session.post

server.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55
from uuid import uuid4
66
import asyncio
7-
from aiohttp import web
7+
from aiohttp import web, ClientSession, ClientTimeout
88

99
from aiohttp.web_ws import WebSocketResponse
1010

@@ -88,7 +88,7 @@ async def handle_new_instance(request):
8888

8989
@routes.get("/model/{model_name}/instance")
9090
async def handle_new_instance(request):
91-
_id = str(uuid4())+str(uuid.uuid1())
91+
_id = str(uuid4()) + str(uuid.uuid1())
9292

9393
model = request.match_info.get("model_name")
9494
instance = await app["bpmn_models"][model].create_instance(_id, {})
@@ -237,10 +237,8 @@ async def handle_instance_state(request):
237237
app = None
238238

239239

240-
241240
async def run():
242241
global app
243-
244242
app = web.Application()
245243
app.on_startup.append(run_as_server)
246244
app.add_routes(routes)

0 commit comments

Comments
 (0)