Fix for Rest Connector for nd (Nexus Dashboard) will not work for remote authentication#132
Open
vijperum wants to merge 8 commits intoCiscoTestAutomation:mainfrom
Open
Fix for Rest Connector for nd (Nexus Dashboard) will not work for remote authentication#132vijperum wants to merge 8 commits intoCiscoTestAutomation:mainfrom
vijperum wants to merge 8 commits intoCiscoTestAutomation:mainfrom
Conversation
…tion made domain optional in connections so that when domain is not there in testbed it defaults to DefaultAuth. And if any new domain is added then value can be specified in testbed.yaml
Overloaded get, post, put and delete so that they are backward compatible.
ThomasJRyan
requested changes
Aug 23, 2024
| timeout (int): Timeout value | ||
| retries (int): Max retries on request exception (default: 3) | ||
| retry_wait (int): Seconds to wait before retry (default: 10) | ||
| verify (bool): defaults to False |
Collaborator
There was a problem hiding this comment.
Defaults to False, but what does it do? A brief description of what we're verifying would be ideal
Comment on lines
-231
to
-232
| log.info("Output received:\n{output}".format(output= | ||
| json.dumps(output, indent=2, sort_keys=True))) |
Collaborator
There was a problem hiding this comment.
We're removing the dump? It'll make reading the output harder
Comment on lines
454
to
460
| api_url (string): subdirectory part of the API URL | ||
| params (dict): Query string parameters | ||
| data (dict): | ||
| json (json) : if request header Content-Type is application/json | ||
| files (dict): | ||
| expected_status_code (int): Expected result | ||
| timeout (int): Maximum time |
| @@ -423,49 +513,97 @@ def delete(self, api_url, expected_status_code=requests.codes.ok, | |||
| timeout (int): Maximum time | |||
Collaborator
There was a problem hiding this comment.
Make sure to update the docstring
Comment on lines
562
to
567
| api_url (string): subdirectory part of the API URL | ||
| params (dict): Query string parameters | ||
| data (dict): | ||
| json (json) : if request header Content-Type is application/json | ||
| files (dict): | ||
| timeout (int): Maximum time |
Comment on lines
580
to
596
| if params and not json: | ||
| response = self.session.delete(full_url, params=params, timeout=timeout, | ||
| verify=self.verify) | ||
| elif params and json: | ||
| response = self.session.delete(full_url, params=params, json=json, | ||
| timeout=timeout, verify=self.verify) | ||
| elif json and not params: | ||
| response = self.session.delete(full_url, json=json, | ||
| timeout=timeout, verify=self.verify) | ||
| elif data: | ||
| response = self.session.delete(full_url, data=data, | ||
| timeout=timeout, verify=self.verify) | ||
| elif files: | ||
| response = self.session.delete(full_url, files=files, | ||
| timeout=timeout, verify=self.verify) | ||
| else: | ||
| response = self.session.delete(full_url, timeout=timeout, verify=self.verify) |
Co-authored-by: Thomas Ryan <tomryan_8_1997@hotmail.com>
Co-authored-by: Thomas Ryan <tomryan_8_1997@hotmail.com>
Updated doc for verify
Addressed Are we not able to pass None to the values? IE, surely if json is None we can still do self.session.post(..., json=None)? Would be better than having this large if/else structure
Co-authored-by: Thomas Ryan <tomryan_8_1997@hotmail.com>
Co-authored-by: Thomas Ryan <tomryan_8_1997@hotmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Redacted default password in source code.
Fix for domain in testbed file made it optional so that it backward compatible.
Added get, post, put, delete with params, data, files, json and removed expected_status_code and return type requests.Response
#131