Unexpected response body when using WebClient behind a proxy server
See original GitHub issueI’m at a bit of a loss as to what the issue is here as my code as been working for some time. We are leveraging the WebClient behind a corporate proxy and have set the proxy parameter in the call. Starting today we were experiencing SSL issues which we appear to have resolved. However, now we are running into a JSONDecoder Issue and am at a loss for what the issue may be.
When manually running a curl command we have no issues
curl -X POST https://slack.com/api/api.test\?token\='xoxb....
However when running the WebClient we are experiencing the following issue (included the logging DEBUG for this step as well):
SLACK_CLIENT = slack.WebClient(token='xoxb...',proxy='<corporate proxy>:8099',base_url='https://slack.com/api/')
DEBUG:slack.web.base_client:Sending a request - url: https://slack.com/api/auth.test, query_params: {}, body_params: {}, files: {}, json_body: {}, headers: {'Content-Type': 'application/json;charset=utf-8', 'Authorization': '(redacted)', 'User-Agent': 'Python/3.8.0 slackclient/2.9.0 Linux/4.14.186-146.268.amzn2.x86_64'}
Traceback (most recent call last):
File "/home/git/.local/lib/python3.8/site-packages/slack/web/base_client.py", line 355, in _urllib_api_call
response_body_data: dict = json.loads(response["body"])
File "/opt/runtime/python-3.8/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/opt/runtime/python-3.8/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/opt/runtime/python-3.8/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Any assistance would be greatly appreciated
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Unexpected response body when using WebClient behind a ...
We are leveraging the WebClient behind a corporate proxy and have set the proxy parameter in the call. Starting today we were experiencing...
Read more >Proxy setting not working with Spring WebClient
Please help, why my code is not functioning if I set the proxy details via JVM run-time arguments or system properties.
Read more >The DFHWBCLI Web Client Interface - IBM
DFHWBCLI is a CICS-supplied utility program that you can invoke via EXEC CICS LINK to provide web client services or outbound HTTP.
Read more >407 Proxy Authentication Required - HTTP - MDN Web Docs
The HTTP 407 Proxy Authentication Required client error status response code indicates that the request has not been applied because it ...
Read more >502 Bad Gateway Error: What It Is and How to Fix It
An in-depth explanation of what a 502 Bad Gateway Error is, including troubleshooting tips to help you resolve this error.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@seratch I double checked that the proxies were set for the
requests
call as well.However, using your recommendation of
run_async=True
seemed to resolve the issue.Really appreciate the recommendation!
This issue has been addressed in version 2.9.1. We’re sorry about this. https://github.com/slackapi/python-slackclient/releases/tag/v2.9.1