Skip to content

Commit f8eda54

Browse files
committed
add helpful hints to webapp set_certificate api call failure
1 parent 2b9aba8 commit f8eda54

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pythonanywhere/api.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,13 @@ def set_ssl(self, certificate, private_key):
136136
response = call_api(url, "post", json={"cert": certificate, "private_key": private_key})
137137
if not response.ok:
138138
raise Exception(
139-
"POST to set SSL details via API failed, got {response}:{response_text}".format(
140-
response=response, response_text=response.text
141-
)
139+
dedent(
140+
"""
141+
POST to set SSL details via API failed, got {response}:{response_text}
142+
If you just created an API token, you need to set the API_TOKEN environment variable or start a new console.
143+
Also you need to have setup a `{domain}` PythonAnywhere webapp for this to work.
144+
"""
145+
).format(response=response, response_text=response.text, domain=self.domain)
142146
)
143147

144148
def get_ssl_info(self):

0 commit comments

Comments
 (0)