diff --git a/felt/core/__init__.py b/felt/core/__init__.py index d5c5ca5..748eb2c 100644 --- a/felt/core/__init__.py +++ b/felt/core/__init__.py @@ -22,6 +22,13 @@ LayerExporter, ZippedExportResult ) +from .constants import ( # noqa + FELT_API_BASE, + FELT_API_URL, + PRIVACY_POLICY_URL, + TOS_URL, + SIGNUP_URL +) from .multi_step_feedback import MultiStepFeedback # noqa from .meta import PLUGIN_METADATA_PARSER # noqa from .exceptions import LayerPackagingException # noqa diff --git a/felt/core/api_client.py b/felt/core/api_client.py index 8c55695..6d96813 100644 --- a/felt/core/api_client.py +++ b/felt/core/api_client.py @@ -41,6 +41,9 @@ from .meta import PLUGIN_METADATA_PARSER from .s3_upload_parameters import S3UploadParameters from .enums import UsageType +from .constants import ( + FELT_API_URL +) PLUGIN_VERSION = "0.7.0" @@ -50,7 +53,6 @@ class FeltApiClient: Client for the Felt API """ - URL = 'https://felt.com/api/v1' USER_ENDPOINT = '/user' WORKSPACES_ENDPOINT = '/workspaces' CREATE_MAP_ENDPOINT = '/maps' @@ -86,7 +88,7 @@ def build_url(endpoint: str) -> QUrl: """ Returns the full url of the specified endpoint """ - return QUrl(FeltApiClient.URL + endpoint) + return QUrl(FELT_API_URL + endpoint) @staticmethod def _to_url_query(parameters: Dict[str, object]) -> QUrlQuery: diff --git a/felt/core/auth.py b/felt/core/auth.py index 9eb404a..7be378e 100644 --- a/felt/core/auth.py +++ b/felt/core/auth.py @@ -31,8 +31,11 @@ ) from .pkce import generate_pkce_pair +from .constants import ( + FELT_API_BASE +) -OAUTH_BASE = "https://felt.com/oauth" +OAUTH_BASE = f"{FELT_API_BASE}/oauth" AUTH_HANDLER_REDIRECT = \ OAUTH_BASE + "/success?client_id=8cb129bd-6962-4f65-8cc9-14b760e8436a" AUTH_HANDLER_REDIRECT_CANCELLED = \ diff --git a/felt/gui/constants.py b/felt/core/constants.py similarity index 72% rename from felt/gui/constants.py rename to felt/core/constants.py index fe81b34..0b6268c 100644 --- a/felt/gui/constants.py +++ b/felt/core/constants.py @@ -13,7 +13,8 @@ # This will get replaced with a git SHA1 when you do a git archive __revision__ = '$Format:%H$' - -SIGNUP_URL = 'https://felt.com/signup' -TOS_URL = 'https://felt.com/terms' -PRIVACY_POLICY_URL = 'https://felt.com/privacy' +FELT_API_BASE = "https://felt.com" +FELT_API_URL = f'{FELT_API_BASE}/api/v1' +SIGNUP_URL = f'{FELT_API_BASE}/signup' +TOS_URL = f'{FELT_API_BASE}/terms' +PRIVACY_POLICY_URL = f'{FELT_API_BASE}/privacy' diff --git a/felt/gui/authorize_dialog.py b/felt/gui/authorize_dialog.py index b8286ad..58af026 100644 --- a/felt/gui/authorize_dialog.py +++ b/felt/gui/authorize_dialog.py @@ -30,7 +30,7 @@ ) from qgis.gui import QgsGui -from .constants import ( +from ..core import ( PRIVACY_POLICY_URL, TOS_URL, SIGNUP_URL diff --git a/felt/gui/create_map_dialog.py b/felt/gui/create_map_dialog.py index c463eda..20ff9c1 100644 --- a/felt/gui/create_map_dialog.py +++ b/felt/gui/create_map_dialog.py @@ -50,10 +50,7 @@ from .authorization_manager import AUTHORIZATION_MANAGER from .colored_progress_bar import ColorBar -from .constants import ( - PRIVACY_POLICY_URL, - TOS_URL -) + from .felt_dialog_header import FeltDialogHeader from .gui_utils import ( GuiUtils, @@ -64,7 +61,9 @@ LayerExporter, LayerSupport, MapUploaderTask, - Map + Map, + PRIVACY_POLICY_URL, + TOS_URL ) WIDGET, _ = uic.loadUiType(GuiUtils.get_ui_file_path('create_map.ui'))