Skip to content

Commit 1ee3844

Browse files
authored
Add api proxy and secrets tutorials
2 parents 238601b + 9e2a05c commit 1ee3844

File tree

6 files changed

+59
-0
lines changed

6 files changed

+59
-0
lines changed

api-proxy-tutorial/index.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>API Proxy Introduction</title>
5+
6+
<!-- Recommended meta tags -->
7+
<meta charset="UTF-8">
8+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
9+
10+
<!-- PyScript CSS -->
11+
<link rel="stylesheet" href="https://pyscript.net/releases/2024.5.2/core.css">
12+
13+
<!-- This script tag bootstraps PyScript -->
14+
<script type="module" src="https://pyscript.net/releases/2024.5.2/core.js"></script>
15+
</head>
16+
<body>
17+
<script type="py" src="./main.py" config="./pyscript.toml" async terminal></script>
18+
</body>
19+
</html>

api-proxy-tutorial/main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from pyscript import fetch
2+
3+
response = await fetch(
4+
"https://examples.pyscriptapps.com/api-proxy-tutorial/api/proxies/status-check",
5+
method="GET"
6+
).json()
7+
8+
print(response)

api-proxy-tutorial/pyscript.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
name = "API Proxy tutorial"

api-secrets-tutorial/index.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>API Secrets Tutorial</title>
5+
6+
<!-- Recommended meta tags -->
7+
<meta charset="UTF-8">
8+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
9+
10+
<!-- PyScript CSS -->
11+
<link rel="stylesheet" href="https://pyscript.net/releases/2024.5.2/core.css">
12+
13+
<!-- This script tag bootstraps PyScript -->
14+
<script type="module" src="https://pyscript.net/releases/2024.5.2/core.js"></script>
15+
</head>
16+
<body>
17+
<script type="py" src="./main.py" config="./pyscript.toml" async terminal></script>
18+
</body>
19+
</html>

api-secrets-tutorial/main.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from pyscript import fetch
2+
3+
response = await fetch(
4+
"https://examples.pyscriptapps.com/secrets/api/proxies/list-secrets",
5+
method="GET"
6+
).json()
7+
8+
9+
print(response)
10+
11+

api-secrets-tutorial/pyscript.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
name = "API Secrets Tutorial"

0 commit comments

Comments
 (0)