From 65a78ebc1b29f515b2ebd268b2aaec155b8055d0 Mon Sep 17 00:00:00 2001 From: havlong Date: Tue, 20 Dec 2022 18:16:35 +0300 Subject: [PATCH] We won't be implementing /endpoints endpoint --- vue-apps-py/src/vue_apps_py/client.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/vue-apps-py/src/vue_apps_py/client.py b/vue-apps-py/src/vue_apps_py/client.py index e7aca28..d5d2957 100644 --- a/vue-apps-py/src/vue_apps_py/client.py +++ b/vue-apps-py/src/vue_apps_py/client.py @@ -5,8 +5,6 @@ from oauthlib.oauth2 import BackendApplicationClient from requests_oauthlib import OAuth2Session vue_apps_url: str = 'https://apps-vue.ru' -default_endpoints: Dict[str, str] = {'access': '/auth', 'refresh': '/refresh', - 'ping': '/ping', 'endpoints': '/endpoints'} class ClientAPI: @@ -14,7 +12,7 @@ class ClientAPI: client_secret: str token: Optional[Any] session: OAuth2Session - endpoints: Dict[str, str] + endpoints: Dict[str, str] = {'access': '/auth', 'refresh': '/refresh', 'ping': '/ping'} def build_url(self, endpoint: str) -> str: return f'{self.vue_apps_url}{self.endpoints[endpoint]}' @@ -29,7 +27,6 @@ class ClientAPI: :param vue_url: custom URL of Vue Apps API to use """ self.vue_apps_url = vue_url - self.endpoints = default_endpoints self.client_id = client_id self.client_secret = client_secret @@ -41,8 +38,6 @@ class ClientAPI: self.token = client_token self.setup_flow() - self.update_endpoints() - def setup_flow(self): """ Method sets up the client OAuth2 Session, which will be refreshing tokens for you automatically on requests @@ -73,9 +68,3 @@ class ClientAPI: self.session.token = self.token response = self.session.get(self.build_url('ping')) return response.status_code == 200 - - def update_endpoints(self): - """ - Refresh endpoints object used to determine path in queries - """ - self.endpoints = self.session.get(self.build_url('endpoints')).json()