Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ import websockets
|
|
8 |
import shutil
|
9 |
from connect4 import PLAYER1, PLAYER2, Connect4
|
10 |
from user import User
|
|
|
11 |
|
12 |
|
13 |
JOIN = {}
|
@@ -322,6 +323,16 @@ async def exe(websocket,connected,key):
|
|
322 |
elif event["command"]["type"]=="write":
|
323 |
|
324 |
await wirte_file(websocket, key,event["project_name"], event["path"], event["content"], connected)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
elif event["command"]["type"]=="create":
|
326 |
if event["item"]=="folder":
|
327 |
await create_folder(websocket, key,event["project_name"], event["path"],event["name"], connected)
|
|
|
8 |
import shutil
|
9 |
from connect4 import PLAYER1, PLAYER2, Connect4
|
10 |
from user import User
|
11 |
+
import requests
|
12 |
|
13 |
|
14 |
JOIN = {}
|
|
|
323 |
elif event["command"]["type"]=="write":
|
324 |
|
325 |
await wirte_file(websocket, key,event["project_name"], event["path"], event["content"], connected)
|
326 |
+
elif event["command"]["type"]=="curl":
|
327 |
+
|
328 |
+
response = requests.get(event['url'])
|
329 |
+
event = {
|
330 |
+
"type": "web-data",
|
331 |
+
|
332 |
+
"data": response.text,
|
333 |
+
|
334 |
+
}
|
335 |
+
websocket.send(json.dumps(event))
|
336 |
elif event["command"]["type"]=="create":
|
337 |
if event["item"]=="folder":
|
338 |
await create_folder(websocket, key,event["project_name"], event["path"],event["name"], connected)
|