Skip to content

Commit

Permalink
Refactor redundant doc url logic to use utility (apache#14080)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanahamilton authored Feb 9, 2021
1 parent 9005f28 commit d2577e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions airflow/api_connexion/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,9 @@
import werkzeug
from connexion import FlaskApi, ProblemException, problem

from airflow import version

if any(suffix in version.version for suffix in ['dev', 'a', 'b']):
doc_link = (
"http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com/docs/apache-airflow/latest"
"/stable-rest-api-ref.html"
)
else:
doc_link = f'https://airflow.apache.org/docs/{version.version}/stable-rest-api-ref.html'
from airflow.utils.docs import get_docs_url

doc_link = get_docs_url("stable-rest-api-ref.html")

EXCEPTIONS_LINK_MAP = {
400: f"{doc_link}#section/Errors/BadRequest",
Expand Down
2 changes: 1 addition & 1 deletion airflow/utils/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

def get_docs_url(page: Optional[str] = None) -> str:
"""Prepare link to Airflow documentation."""
if "dev" in version.version:
if any(suffix in version.version for suffix in ['dev', 'a', 'b']):
result = (
"http://apache-airflow-docs.s3-website.eu-central-1.amazonaws.com/docs/apache-airflow/latest/"
)
Expand Down

0 comments on commit d2577e4

Please sign in to comment.