datacosmos 0.0.6__py3-none-any.whl → 0.0.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of datacosmos might be problematic. Click here for more details.

@@ -12,8 +12,9 @@ import yaml
12
12
  from pydantic import field_validator
13
13
  from pydantic_settings import BaseSettings, SettingsConfigDict
14
14
 
15
- from config.models.m2m_authentication_config import M2MAuthenticationConfig
16
- from config.models.url import URL
15
+ from datacosmos.config.models.authentication_config import AuthenticationConfig
16
+ from datacosmos.config.models.m2m_authentication_config import M2MAuthenticationConfig
17
+ from datacosmos.config.models.url import URL
17
18
 
18
19
 
19
20
  class Config(BaseSettings):
@@ -25,7 +26,7 @@ class Config(BaseSettings):
25
26
  extra="allow",
26
27
  )
27
28
 
28
- authentication: Optional[M2MAuthenticationConfig] = None
29
+ authentication: Optional[AuthenticationConfig] = None
29
30
  stac: Optional[URL] = None
30
31
  datacosmos_cloud_storage: Optional[URL] = None
31
32
  mission_id: int = 0
@@ -94,15 +95,15 @@ class Config(BaseSettings):
94
95
  environment=os.getenv("ENVIRONMENT", "test"),
95
96
  )
96
97
 
97
- @field_validator("authentication", mode="before")
98
+ @field_validator("authentication", mode="after")
98
99
  @classmethod
99
100
  def validate_authentication(
100
- cls, auth_data: Optional[dict]
101
+ cls, auth: Optional[M2MAuthenticationConfig]
101
102
  ) -> M2MAuthenticationConfig:
102
103
  """Ensure authentication is provided and apply defaults.
103
104
 
104
105
  Args:
105
- auth_data (Optional[dict]): The authentication config as a dictionary.
106
+ auth (Optional[M2MAuthenticationConfig]): The authentication config.
106
107
 
107
108
  Returns:
108
109
  M2MAuthenticationConfig: The validated authentication configuration.
@@ -110,11 +111,10 @@ class Config(BaseSettings):
110
111
  Raises:
111
112
  ValueError: If authentication is missing or required fields are not set.
112
113
  """
113
- if not auth_data:
114
- return cls.apply_auth_defaults(M2MAuthenticationConfig())
115
-
116
- auth = cls.parse_auth_config(auth_data)
117
- auth = cls.apply_auth_defaults(auth)
114
+ if auth is None:
115
+ auth = cls.apply_auth_defaults(M2MAuthenticationConfig())
116
+ else:
117
+ auth = cls.apply_auth_defaults(auth)
118
118
 
119
119
  cls.check_required_auth_fields(auth)
120
120
  return auth
@@ -0,0 +1,15 @@
1
+ """Authentication configuration options."""
2
+
3
+ from typing import Union
4
+
5
+ from datacosmos.config.models.local_user_account_authentication_config import (
6
+ LocalUserAccountAuthenticationConfig,
7
+ )
8
+ from datacosmos.config.models.m2m_authentication_config import M2MAuthenticationConfig
9
+ from datacosmos.config.models.no_authentication_config import NoAuthenticationConfig
10
+
11
+ AuthenticationConfig = Union[
12
+ NoAuthenticationConfig,
13
+ LocalUserAccountAuthenticationConfig,
14
+ M2MAuthenticationConfig,
15
+ ]
@@ -0,0 +1,26 @@
1
+ """Configuration for local user account authentication.
2
+
3
+ When this is chosen, the user will be prompted to log in using their OPS credentials.
4
+ This will be used for running scripts locally.
5
+ """
6
+
7
+ from typing import Literal
8
+
9
+ from pydantic import BaseModel
10
+
11
+
12
+ class LocalUserAccountAuthenticationConfig(BaseModel):
13
+ """Configuration for local user account authentication.
14
+
15
+ When this is chosen, the user will be prompted to log in using their OPS credentials.
16
+ This will be used for running scripts locally.
17
+ """
18
+
19
+ type: Literal["local"]
20
+ client_id: str
21
+ authorization_endpoint: str
22
+ token_endpoint: str
23
+ redirect_port: int
24
+ scopes: str
25
+ audience: str
26
+ cache_file: str
@@ -0,0 +1,17 @@
1
+ """No authentication configuration.
2
+
3
+ This is used when running scripts in tests.
4
+ """
5
+
6
+ from typing import Literal
7
+
8
+ from pydantic import BaseModel
9
+
10
+
11
+ class NoAuthenticationConfig(BaseModel):
12
+ """No authentication configuration.
13
+
14
+ This is used when running scripts in tests.
15
+ """
16
+
17
+ type: Literal["none"]
@@ -12,7 +12,7 @@ from oauthlib.oauth2 import BackendApplicationClient
12
12
  from requests.exceptions import ConnectionError, HTTPError, RequestException, Timeout
13
13
  from requests_oauthlib import OAuth2Session
14
14
 
15
- from config.config import Config
15
+ from datacosmos.config.config import Config
16
16
  from datacosmos.exceptions.datacosmos_exception import DatacosmosException
17
17
 
18
18
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datacosmos
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: A library for interacting with DataCosmos from Python code
5
5
  Author-email: Open Cosmos <support@open-cosmos.com>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,10 +1,13 @@
1
- config/__init__.py,sha256=KCsaTb9-ZgFui1GM8wZFIPLJy0D0O8l8Z1Sv3NRD9UM,140
2
- config/config.py,sha256=vtimmFY2zOXV3OjT7sS5P0p1sW_-ecB5VCF6cseSk4g,7165
3
- config/models/__init__.py,sha256=r3lThPkyKjBjUZXRNscFzOrmn_-m_i9DvG3RePfCFYc,41
4
- config/models/m2m_authentication_config.py,sha256=n76N4bakpPPycTOeKpiM8pazYtNqiJGMzZXmI_ogbHM,847
5
- config/models/url.py,sha256=fwr2C06e_RDS8AWxOV_orVxMWhc57bzYoWSjFxQbkwg,835
6
1
  datacosmos/__init__.py,sha256=dVHKpbz5FVtfoJAWHRdsUENG6H-vs4UrkuwnIvOGJr4,66
7
- datacosmos/datacosmos_client.py,sha256=sivVYf45QEHTkUO62fnb1fnObKVmUngTR1Ga-ZRnoQE,4967
2
+ datacosmos/datacosmos_client.py,sha256=Uage-PRVRrDWy5frefcR2FClDsdpbFBS4JQC3OCupJU,4978
3
+ datacosmos/config/__init__.py,sha256=KCsaTb9-ZgFui1GM8wZFIPLJy0D0O8l8Z1Sv3NRD9UM,140
4
+ datacosmos/config/config.py,sha256=xSzri8sr_hRK1JlG0mxuBW5dLQ4ExL00uk3-77Z4wHo,7243
5
+ datacosmos/config/models/__init__.py,sha256=r3lThPkyKjBjUZXRNscFzOrmn_-m_i9DvG3RePfCFYc,41
6
+ datacosmos/config/models/authentication_config.py,sha256=01Q90-yupbJ5orYDtatZIm9EaL7roQ-oUMoZfFMRzIM,499
7
+ datacosmos/config/models/local_user_account_authentication_config.py,sha256=8WApn720MBXMKQa6w7bCd7Z37GRmYR-I7mBUgUI20lQ,701
8
+ datacosmos/config/models/m2m_authentication_config.py,sha256=n76N4bakpPPycTOeKpiM8pazYtNqiJGMzZXmI_ogbHM,847
9
+ datacosmos/config/models/no_authentication_config.py,sha256=x5xikSGPuqQbrf_S2oIWXo5XxAORci2sSE5KyJvZHVw,312
10
+ datacosmos/config/models/url.py,sha256=fwr2C06e_RDS8AWxOV_orVxMWhc57bzYoWSjFxQbkwg,835
8
11
  datacosmos/exceptions/__init__.py,sha256=Crz8W7mOvPUXYcfDVotvjUt_3HKawBpmJA_-uel9UJk,45
9
12
  datacosmos/exceptions/datacosmos_exception.py,sha256=rKjJvQDvCEbxXWWccxB5GI_sth662bW8Yml0hX-vRw4,923
10
13
  datacosmos/stac/__init__.py,sha256=B4x_Mr4X7TzQoYtRC-VzI4W-fEON5WUOaz8cWJbk3Fc,214
@@ -41,8 +44,8 @@ datacosmos/utils/http_response/check_api_response.py,sha256=dKWW01jn2_lWV0xpOBAB
41
44
  datacosmos/utils/http_response/models/__init__.py,sha256=Wj8YT6dqw7rAz_rctllxo5Or_vv8DwopvQvBzwCTvpw,45
42
45
  datacosmos/utils/http_response/models/datacosmos_error.py,sha256=Uqi2uM98nJPeCbM7zngV6vHSk97jEAb_nkdDEeUjiQM,740
43
46
  datacosmos/utils/http_response/models/datacosmos_response.py,sha256=oV4n-sue7K1wwiIQeHpxdNU8vxeqF3okVPE2rydw5W0,336
44
- datacosmos-0.0.6.dist-info/licenses/LICENSE.md,sha256=vpbRI-UUbZVQfr3VG_CXt9HpRnL1b5kt8uTVbirxeyI,1486
45
- datacosmos-0.0.6.dist-info/METADATA,sha256=62t4WIjxXxYdgVWDyJTcLnBYS9LHU1yuS872Zu8YqbQ,896
46
- datacosmos-0.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
47
- datacosmos-0.0.6.dist-info/top_level.txt,sha256=Iu5b533Fmdfz0rFKTnuBPjSUOQL2lEkTfHxsokP72s4,18
48
- datacosmos-0.0.6.dist-info/RECORD,,
47
+ datacosmos-0.0.7.dist-info/licenses/LICENSE.md,sha256=vpbRI-UUbZVQfr3VG_CXt9HpRnL1b5kt8uTVbirxeyI,1486
48
+ datacosmos-0.0.7.dist-info/METADATA,sha256=tCAZlxKlDV8qI9pjgvdREZBffzkwJ4Ko0CMiK9oe2Bg,896
49
+ datacosmos-0.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
50
+ datacosmos-0.0.7.dist-info/top_level.txt,sha256=ueobs5CNeyDbPMgXPcVV0d0yNdm8CvGtDT3CaksRVtA,11
51
+ datacosmos-0.0.7.dist-info/RECORD,,
File without changes
File without changes
File without changes