GithubHelp home page GithubHelp logo

Comments (4)

simisimis avatar simisimis commented on May 22, 2024 1

would be nice if that would be added as I am not able to use slackclient from hosts behind proxy

from python-slack-sdk.

aaronhackney avatar aaronhackney commented on May 22, 2024 1

This was solved in https://github.com/slackapi/python-slackclient version 1.06.
I have posted a small write up of using the proxy feature here with a short explanation of how it works.

from python-slack-sdk.

bryanjacquot avatar bryanjacquot commented on May 22, 2024

I have slackclient working from behind a proxy by setting the HTTP_PROXY and HTTP_PROXY environment variables.

from python-slack-sdk.

NineNein avatar NineNein commented on May 22, 2024

If someone needs it quick and dirty, here my solution. (Setting the HTTP_PROXY and HTTP_PROXY don't work for me.)

import requests
import websocket
import copy


#patch requests and websockets to have a fixed proxy
old_post = copy.deepcopy(requests.post)
def new_post(url, data=None, json=None, proxies = {"http": "http://proxy:1234", "https": "https://proxy:1234"}, **kwargs):
    kwargs["proxies"] = proxies
    return old_post(url, data, json, **kwargs)

requests.post = new_post

old_create_connection = copy.deepcopy(websocket.create_connection)
def new_create_connection(url, timeout=None, class_=websocket.WebSocket, http_proxy_host="proxy", http_proxy_port=1234, **options):
    options["http_proxy_host"] = http_proxy_host
    options["http_proxy_port"] = http_proxy_port
    return old_create_connection(url, timeout, class_, **options)

websocket.create_connection = new_create_connection

from slackclient import SlackClient

...

from python-slack-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.