diff --git a/webapp/templates/docs.html b/webapp/templates/docs.html index a527760..f2bc5c6 100644 --- a/webapp/templates/docs.html +++ b/webapp/templates/docs.html @@ -34,7 +34,7 @@
- curl -X GET http://www.cochar.pl/api/v1/get + curl -X GET https://www.cochar.pl/api/v1/get
{ @@ -91,7 +91,7 @@year
400 Bad Requestcurl -X GET http://www.cochar.pl/api/v1/get?year=invalidcurl -X GET https://www.cochar.pl/api/v1/get?year=invalid
@@ -116,7 +116,7 @@country
curl -X GET - http://www.cochar.pl/api/v1/get?country=invalid
@@ -157,7 +157,7 @@age
400 Bad Request- curl -X GET http://www.cochar.pl/api/v1/get?age=14 + curl -X GET https://www.cochar.pl/api/v1/get?age=14
{ @@ -168,7 +168,7 @@age
400 Bad Request- curl -X GET http://www.cochar.pl/api/v1/get?age=invalid + curl -X GET https://www.cochar.pl/api/v1/get?age=invalid
{ @@ -186,7 +186,7 @@sex
Choices to specify gender: "M", "F"
400 Bad Request- curl -X GET http://www.cochar.pl/api/v1/get?sex=invalid + curl -X GET https://www.cochar.pl/api/v1/get?sex=invalid
{ @@ -224,7 +224,7 @@era
"classic-1890" is not supported
400 Bad Request- curl -X GET http://www.cochar.pl/api/v1/get?era=invalid + curl -X GET https://www.cochar.pl/api/v1/get?era=invalid
{ @@ -251,7 +251,7 @@occup_type
curl -X GET - http://www.cochar.pl/api/v1/get?occup_type=invalid
@@ -273,7 +273,7 @@tags
400 Bad Requestcurl -X GET http://www.cochar.pl/api/v1/get?tags=invalidcurl -X GET https://www.cochar.pl/api/v1/get?tags=invalid
@@ -294,7 +294,7 @@occupation
400 Bad Request- curl -X GET http://www.cochar.pl/api/v1/get?occupation=invalid + curl -X GET https://www.cochar.pl/api/v1/get?occupation=invalid
{ @@ -317,7 +317,7 @@None of the occupation meet searching criteria:
400 Bad Requestcurl -X GET http://www.cochar.pl/api/v1/get?era=modern&tags=lovecraftiancurl -X GET https://www.cochar.pl/api/v1/get?era=modern&tags=lovecraftian
diff --git a/webapp/webapp.py b/webapp/webapp.py index 17ecaab..74f016d 100644 --- a/webapp/webapp.py +++ b/webapp/webapp.py @@ -30,6 +30,7 @@ OCCUPATIONS = cochar.occup.get_occupation_list() LIMITS = ["10 per second", "10000 per day"] + def get_remote_address() -> str: """Get client's IP address. pythonanywhere.com stores original client's IP in 'X-Real-IP' header. @@ -39,7 +40,7 @@ def get_remote_address() -> str: :return: client's IP address :rtype: str """ - return request.headers.get('X-Real-IP') or request.remote_addr or "127.0.0.1" + return request.headers.get("X-Real-IP") or request.remote_addr or "127.0.0.1" with open(_README, "r", encoding="utf-8") as readme: @@ -174,7 +175,7 @@ def get(self): "\nPlease try again later.\n" "If you did not exceed the limit check if someone " "else in your network is using this website" - ) + ), }, 429