gs-quant
gs-quant copied to clipboard
Error text on invalid scope is overly verbose
Describe the problem. The error text if your application account doen't have the correct scope is too verbose
> python .\sample.py
Traceback (most recent call last):
File ".\sample.py", line 14, in <module>
with GsSession.get(Environment.PROD, CLIENTID, SECRET, scopes=('read_product_data', 'run_analytics')):
File "C:\Users\scott\AppData\Roaming\Python\Python37\site-packages\gs_quant\context_base.py", line 67, in __enter__
self._on_enter()
File "C:\Users\scott\AppData\Roaming\Python\Python37\site-packages\gs_quant\session.py", line 81, in _on_enter
self.init()
File "C:\Users\scott\AppData\Roaming\Python\Python37\site-packages\gs_quant\session.py", line 92, in init
self._authenticate()
File "C:\Users\scott\AppData\Roaming\Python\Python37\site-packages\gs_quant\session.py", line 270, in _authenticate
raise MqAuthenticationError(reply.status_code, reply.text, context=self.auth_url)
gs_quant.errors.MqAuthenticationError: context: https://idfs.gs.com/as/token.oauth2
status: 400, message: {"error_description":"The requested scope(s) must be blank or a subset of the provided scopes.","error":"invalid_scope"}
Describe the solution you'd like The message should be - "your application account needs the following scopes X,Y,Z to invoke the APIs you used. Request scopes at URL"
Are you willing to contribute No