-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtest_fetch.html
More file actions
42 lines (39 loc) · 1.22 KB
/
test_fetch.html
File metadata and controls
42 lines (39 loc) · 1.22 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
<html>
<head>
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
</head>
<body>
<py-config>
packages = [ "sqlite-utils"]
# this runs if we launch fetch.html from 'http://127.0.0.1:8000/fetch.html'
# error is : PyScript: Access to local files (using "Paths:" in <py-config>) is not available when directly opening a HTML file
[[fetch]]
#from = 'http://127.0.0.1:8000/'
from = 'http://localhost:8000/'
files = ['readme.txt']
to_folder = './here'
[[fetch]]
from = "https://pyscript.net/examples/"
files = ["utils.py"]
to_folder = "docs"
[[fetch]]
from = "https://gist.githubusercontent.com/FabioRosado/faba0b7f6ad4438b07c9ac567c73b864/raw/37603b76dc7ef7997bf36781ea0116150f727f44/"
files = ["todo.py"]
to_folder = "docs"
</py-config>
<h1>Fetch Example</h1>
<div id="myplot"></div>
<div>
<py-terminal>
</div>
<py-script>
import os
for d in os.walk('.'):
for file in d[2]:
print(f'{d[0]}/{file}')
with open('./here/readme.txt', 'r') as fp:
print(fp.read())
</py-script>
</body>
</html>