MCPcopy
hub / github.com/legendary-gl/legendary / resume_session

Method resume_session

legendary/api/egs.py:79–94  ·  view source on GitHub ↗
(self, session)

Source from the content-addressed store, hash-verified

77 self._oauth_basic = HTTPBasicAuth(self._user_basic, self._pw_basic)
78
79 def resume_session(self, session):
80 self.session.headers['Authorization'] = f'bearer {session["access_token"]}'
81 r = self.session.get(f'https://{self._oauth_host}/account/api/oauth/verify',
82 timeout=self.request_timeout)
83 if r.status_code >= 500:
84 r.raise_for_status()
85
86 j = r.json()
87 if 'errorMessage' in j:
88 self.log.warning(f'Login to EGS API failed with errorCode: {j["errorCode"]}')
89 raise InvalidCredentialsError(j['errorCode'])
90
91 # update other data
92 session.update(j)
93 self.user = session
94 return self.user
95
96 def start_session(self, refresh_token: str = None, exchange_token: str = None,
97 authorization_code: str = None, client_credentials: bool = False) -> dict:

Callers 1

_loginMethod · 0.80

Calls 1

Tested by

no test coverage detected