Skip to content

Commit

Permalink
Merge pull request #3 from DanNiESh/endpoint
Browse files Browse the repository at this point in the history
skip endpoint discovery
  • Loading branch information
tzumainn authored May 9, 2024
2 parents 8bc522f + 9f21b93 commit 43215ec
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions esi/lease/lease_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,29 @@ def _make_proxy(self, instance):
version_kwargs = {}
if version_string:
version_kwargs['version'] = version_string
if getattr(
self.supported_versions[str(version_string)],
'skip_discovery',
False,
):
# set the endpoint_override to the current
# catalog endpoint value + version number,
# otherwise next request will try to perform discovery.
temp_adapter = config.get_session_client('lease')
ep_override = temp_adapter.get_endpoint(skip_discovery=True)
ep_key = '{service_type}_endpoint_override'.format(
service_type=self.service_type.replace('-', '_')
)
config.config[ep_key] = '{}/v{}'.format(
ep_override, version_string)
return config.get_session_client(
'lease',
allow_version_hack=True,
constructor=self.supported_versions[
str(version_string)
],
**version_kwargs,
)
else:
supported_versions = sorted(
[int(f) for f in self.supported_versions]
Expand Down
1 change: 1 addition & 0 deletions esi/lease/v1/_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Proxy(proxy.Proxy):
"node": _node.Node,
"event": _event.Event
}
skip_discovery = True

def _get_with_fields(self, resource_type, value, fields=None):
"""Fetch an ESI-LEAP resource.
Expand Down
2 changes: 1 addition & 1 deletion esi/tests/fakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ def make_fake_event(id, event_type, last_event_time):


def get_lease_endpoint():
url = "https://lease.example.com/v1"
url = "https://lease.example.com"
return ks_discover.EndpointData(catalog_url=url, api_version=(1, 0))

0 comments on commit 43215ec

Please sign in to comment.