Skip to content

Commit 859a228

Browse files
authored
Update endpoint access examples: added info about accessing auth-protected apps (#16145)
1 parent a808ff9 commit 859a228

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/lightning_app/components/serve/python_server.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,15 @@ def request_code_sample(url: str) -> str:
7070
response = requests.post('"""
7171
+ url
7272
+ """', json={
73-
"image": img
74-
})"""
73+
"image": img
74+
})
75+
# If you are using basic authentication for your app, you should add your credentials to the request:
76+
# response = requests.post('"""
77+
+ url
78+
+ """', json={
79+
# "image": img
80+
# }, auth=requests.auth.HTTPBasicAuth('your_username', 'your_password'))
81+
"""
7582
)
7683

7784
@staticmethod
@@ -112,8 +119,14 @@ def request_code_sample(url: str) -> str:
112119
response = requests.post('"""
113120
+ url
114121
+ """', json={
115-
"text": "A portrait of a person looking away from the camera"
122+
"text": "A portrait of a person looking away from the camera"
116123
})
124+
# If you are using basic authentication for your app, you should add your credentials to the request:
125+
# response = requests.post('"""
126+
+ url
127+
+ """', json={
128+
# "text": "A portrait of a person looking away from the camera"
129+
# }, auth=requests.auth.HTTPBasicAuth('your_username', 'your_password'))
117130
"""
118131
)
119132

0 commit comments

Comments
 (0)