8000 Implement get server info by graysonarts · Pull Request #84 · tableau/server-client-python · GitHub
[go: up one dir, main page]

Skip to content

Implement get server info #84

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

Merged
merged 2 commits into from
Oct 28, 2016
Merged

Implement get server info #84

merged 2 commits into from
Oct 28, 2016

Conversation

graysonarts
Copy link
Contributor

Quickly implemented serverInfo endpoint.

@graysonarts graysonarts added this to the 0.2 milestone Oct 28, 2016
Copy link
Collaborator
@t8y8 t8y8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

url = request_object.apply_query_params(url)
server_response = self.parent_srv.session.get(url, **self.parent_srv.http_options)
self._check_status(server_response)
if server_response.encoding:
Copy link
Collaborator
@t8y8 t8y8 Oct 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question -- why check for encoding? Will it ever not be there?

Does this mean if there isn't an encoding there is nothing to log?

(I know the other get does the same thing, just curious)

Copy link
Contributor Author
@graysonarts graysonarts Oct 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember why we needed to do this, but it's the pattern that all of the others follow.

If we cannot encode the response into a string, then we do not log anything.

@graysonarts graysonarts merged commit a6975db into tableau:development Oct 28, 2016
@graysonarts graysonarts deleted the feature-serverinfo branch October 28, 2016 19:15
@@ -15,6 +16,16 @@ def _check_status(server_response):
if server_response.status_code not in Success_codes:
raise ServerResponseError.from_response(server_response.content)

def get_unauthenticated_request(self, url, request_object=None):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like we should probably have a "_get_request" method and these two just call the underlying one. Unauthenticated can call directly. Normal can create the headers list and pass it in. The rest of the code is identical.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was planning to do that in a separate checkin anyway. There is a bunch of overlap that I think I can reduce, but it would have been noise in this change.


class ServerInfo(Endpoint):
def __init__(self, parent_srv):
super(Endpoint, self).__init__()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to go through and update all of these. This is not the correct way to do it. "Endpoint" should be "ServerInfo". It doesn't matter since Endpoint and object both have empty constrctors. Which leaves us with ... we should just delete all of these.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was another thing that I noticed while doing this change. EVERY Endpoint takes parent_srv, so I'm going to rip all of the custom ctors out and just allow the base object's ctor which doesn't currently take a parent_srv take the parent_srv

@LGraber
Copy link
Contributor
LGraber commented Oct 28, 2016

Couple of comments for cleanup later. You already submitted so they can be dealt with the next time

@t8y8
Copy link
Collaborator
t8y8 commented Oct 28, 2016

@LGraber I think I noticed another weird thing (unrelated to his change), I might be able to incorporate your feedback into that

bryceglarsen pushed a commit to bryceglarsen/server-client-python that referenced this pull request Dec 28, 2023
* Create CONTRIBUTORS.md

* Adding Charley Peng who contributed doc fixes

* Update CONTRIBUTORS.md
bryceglarsen pushed a commit to bryceglarsen/server-client-python that referenced this pull request Dec 28, 2023
* Create CONTRIBUTORS.md

* Adding Charley Peng who contributed doc fixes

* Update CONTRIBUTORS.md
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.

3 participants
0