Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug logging to requests #198

Merged
merged 3 commits into from
Oct 7, 2024
Merged

Add debug logging to requests #198

merged 3 commits into from
Oct 7, 2024

Conversation

mcg1969
Copy link
Collaborator

@mcg1969 mcg1969 commented Oct 5, 2024

Adds a response hook to print each and every request to stderr. By doing it this way we minimize changes to the code flow. And by printing it to stderr we should keep testing undisturbed

Example output:

(base) ae5-tools $ ae5 project list
Connecting to user account [email protected].
                                                     project
                     resource                        _create  --- s3_ ---    ...
name  owner  editor  _profile  id  created  updated  _status  bucket  path  s...
----  -----  ------  --------  --  -------  -------  -------  ------  ----  ----
(base) ae5-tools $ API_DEBUG=1 ae5 project list
Connecting to user account [email protected].
GET https://anaconda.example.com/api/v2/projects 200
                                                     project
                     resource                        _create  --- s3_ ---    ...
name  owner  editor  _profile  id  created  updated  _status  bucket  path  s...
----  -----  ------  --------  --  -------  -------  -------  ------  ----  ----
(base) ae5-tools $ API_DEBUG=1 ae5 logout
Connecting to user account [email protected].
GET https://anaconda.example.com/logout 302
-> GET https://anaconda.example.com/auth/realms/AnacondaPlatform/protocol/openid-connect/logout?... 302
-> GET https://anaconda.example.com/ 200
Logged out as [email protected].
(base) ae5-tools $ API_DEBUG=1 ae5 project list
Connecting to user account [email protected].
Password for [email protected]: 
GET https://anaconda.example.com/auth/realms/AnacondaPlatform/protocol/openid-connect/auth?... 200
POST https://anaconda.example.com/auth/realms/AnacondaPlatform/login-actions/authenticate?... 302
-> GET https://anaconda.example.com/login?... 302
GET https://anaconda.example.com/ 200
GET https://anaconda.example.com/api/v2/projects 200
                                                     project
                     resource                        _create  --- s3_ ---    ...
name  owner  editor  _profile  id  created  updated  _status  bucket  path  s...
----  -----  ------  --------  --  -------  -------  -------  ------  ----  ----
(base) ae5-tools $ API_DEBUG=1 ae5 logout
Connecting to user account [email protected].
GET https://anaconda.example.com/logout 302
-> GET https://anaconda.example.com/auth/realms/AnacondaPlatform/protocol/openid-connect/logout?... 302
-> GET https://anaconda.example.com/ 200
Logged out as [email protected].
(base) ae5-tools $ API_DEBUG=1 ae5 project list --impersonate
Connecting to user account [email protected].
Connecting to admin account [email protected].
POST https://anaconda.example.com/auth/realms/master/protocol/openid-connect/token 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/ae-admin/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/ae-creator/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/ae-deployer/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/ae-uploader/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/ae-userview/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/default-roles-anaconda-platform/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/default-roles-anacondaplatform/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/offline_access/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/roles/uma_authorization/users?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/groups?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/groups/41a03f1d-306d-4f19-a819-97a60e10f049/members?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/groups/a753d069-2cbf-4663-884e-37c8a44ac7d9/members?... 200
GET https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/groups/d0f377c9-6c9c-4140-bfdc-e6557f50dac7/members?... 200
POST https://anaconda.example.com/auth/admin/realms/AnacondaPlatform/users/f605d5ca-409f-45a2-8421-5a2640719dda/impersonation 200
GET https://anaconda.example.com/auth/realms/AnacondaPlatform/protocol/openid-connect/auth?... 302
GET https://anaconda.example.com/login?... 302
GET https://anaconda.example.com/?... 200
GET https://anaconda.example.com/api/v2/projects 200
                                                     project
                     resource                        _create  --- s3_ ---    ...
name  owner  editor  _profile  id  created  updated  _status  bucket  path  s...
----  -----  ------  --------  --  -------  -------  -------  ------  ----  ----

@mcg1969 mcg1969 merged commit 3fa58e9 into master Oct 7, 2024
1 check passed
@mcg1969 mcg1969 deleted the debug_api branch October 7, 2024 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants