Skip to content

Commit

Permalink
Minor refactoring: consolidate felt.com reference to single variable (#…
Browse files Browse the repository at this point in the history
…62)

* be able to specify felt.com in a single place

* avoid //

* fix import path

* shuffle constants to be easy to import from both core and gui

* move constants to core
  • Loading branch information
springmeyer authored Mar 7, 2024
1 parent 467d509 commit 6e943b9
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 13 deletions.
7 changes: 7 additions & 0 deletions felt/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions felt/core/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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'
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion felt/core/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = \
Expand Down
9 changes: 5 additions & 4 deletions felt/gui/constants.py → felt/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
2 changes: 1 addition & 1 deletion felt/gui/authorize_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
)
from qgis.gui import QgsGui

from .constants import (
from ..core import (
PRIVACY_POLICY_URL,
TOS_URL,
SIGNUP_URL
Expand Down
9 changes: 4 additions & 5 deletions felt/gui/create_map_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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'))
Expand Down

0 comments on commit 6e943b9

Please sign in to comment.