Code Monkey home page Code Monkey logo

Comments (3)

p-mongo avatar p-mongo commented on June 21, 2024 1

Works correctly after I updated my tree.

from drivers-atlas-testing.

prashantmital avatar prashantmital commented on June 21, 2024

Instead of always including the full response by default, I have added the ability to see this output at an elevated logging level. I have also added a brief documentation note on how to use logging levels: https://mongodb-labs.github.io/drivers-atlas-testing/installing-running-locally.html#debugging

Just use the 'debug' logging level and you will see the full request and response. For example:

$ astrolabe --log-level DEBUG projects get-one --group-name x1
DEBUG:astrolabe.cli:Atlas Client Configuration:
======================  ===================================
Configuration option    Value
======================  ===================================
Atlas API base URL      https://cloud.mongodb.com/api/atlas
HTTP timeout (s)        10.0
======================  ===================================
DEBUG:atlasclient.client:Request (GET https://cloud.mongodb.com/api/atlas/v1.0/groups/byName/x1 {'auth': <requests.auth.HTTPDigestAuth object at 0x106caffd0>, 'params': {}, 'json': {}, 'timeout': 10.0})
DEBUG:atlasclient.client:Response (GET {'detail': 'The current user is not in the group, or the group does not exist.', 'error': 401, 'errorCode': 'NOT_IN_GROUP', 'parameters': [], 'reason': 'Unauthorized'})
Traceback (most recent call last):
  File "/Users/pmital/.pyenv/versions/3.7.5/envs/atlastesting/bin/astrolabe", line 11, in <module>
    load_entry_point('astrolabe', 'console_scripts', 'astrolabe')()
  File "/Users/pmital/.pyenv/versions/3.7.5/envs/atlastesting/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/pmital/.pyenv/versions/3.7.5/envs/atlastesting/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/pmital/.pyenv/versions/3.7.5/envs/atlastesting/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/pmital/.pyenv/versions/3.7.5/envs/atlastesting/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/pmital/.pyenv/versions/3.7.5/envs/atlastesting/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/pmital/.pyenv/versions/3.7.5/envs/atlastesting/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/pmital/.pyenv/versions/3.7.5/envs/atlastesting/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/pmital/Developer/drivers-atlas-testing/astrolabe/cli.py", line 204, in get_one_project_by_name
    pprint(ctx.obj.groups.byName[group_name].get().data)
  File "/Users/pmital/Developer/drivers-atlas-testing/atlasclient/client.py", line 56, in get
    return self._client.request('GET', self._path, **params)
  File "/Users/pmital/Developer/drivers-atlas-testing/atlasclient/client.py", line 221, in request
    return self.handle_response(method, response)
  File "/Users/pmital/Developer/drivers-atlas-testing/atlasclient/client.py", line 258, in handle_response
    raise AtlasAuthenticationError('401: Unauthorized.', **kwargs)
atlasclient.exceptions.AtlasAuthenticationError: 401: Unauthorized. Error Code: 'NOT_IN_GROUP' (GET https://cloud.mongodb.com/api/atlas/v1.0/groups/byName/x1)

from drivers-atlas-testing.

p-mongo avatar p-mongo commented on June 21, 2024

The complete response is not provided. Example: https://gist.github.com/p-mongo/6711c5f08e2926b3cd4ab825876e828b

I have a patch as follows that I am using:

carbon% git diff
diff --git a/atlasclient/client.py b/atlasclient/client.py
index d0d8a09..01a9d6a 100644
--- a/atlasclient/client.py
+++ b/atlasclient/client.py
@@ -257,5 +257,6 @@ class AtlasClient:
         if response.status_code == 409:
             raise AtlasApiError('409: Conflict.', **kwargs)
 
+        print(response.content)
         raise AtlasApiError('{}: Unknown.'.format(response.status_code),
                             **kwargs)

This patch produces the following line in the linked gist:

b'{"detail":"Unexpected error.","error":500,"errorCode":"UNEXPECTED_ERROR","parameters":[],"reason":"Internal Server Error"}'

The remainder of the gist (which is output produced by unpatched astrolabe) does not include the "reason":"Internal Server Error" part.

from drivers-atlas-testing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.