8000 Limit request content to 1000 bytes, remove redundant response logging · slaperle/server-client-python@0aca85b · GitHub
[go: up one dir, main page]

Skip to content

Commit 0aca85b

Browse files
committed
Limit request content to 1000 bytes, remove redundant response logging
1 parent ef95e53 commit 0aca85b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tableauserverclient/server/endpoint/endpoint.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,20 @@ def _make_request(self, method, url, content=None, request_object=None,
5252

5353
l B37F ogger.debug(u'request {}, url: {}'.format(method.__name__, url))
5454
if content:
55-
logger.debug(u'request content: {}'.format(content))
55+
logger.debug(u'request content: {}'.format(content[:1000]))
5656

5757
server_response = method(url, **parameters)
5858
self.parent_srv._namespace.detect(server_response.content)
5959
self._check_status(server_response)
6060

6161
# This check is to determine if the response is a text response (xml or otherwise)
6262
# so that we do not attempt to log bytes and other binary data.
63-
if server_response.encoding:
63+
if len(server_response.content) > 0 and server_response.encoding:
6464
logger.debug(u'Server response from {0}:\n\t{1}'.format(
6565
url, server_response.content.decode(server_response.encoding)))
6666
return server_response
6767

6868
def _check_status(self, server_response):
69-
if len(server_response.content) > 0:
70-
logger.debug(self._safe_to_log(server_response))
7169
if server_response.status_code >= 500:
7270
raise InternalServerError(server_response)
7371
elif server_response.status_code not in Success_codes:

0 commit comments

Comments
 (0)
0