Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor refactoring: consolidate felt.com reference to single variable #62

Merged
merged 6 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading