Skip to content
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

ThreadedWebsocketManager and proxy #1242

Open
Excelsior9000 opened this issue Sep 2, 2022 · 1 comment
Open

ThreadedWebsocketManager and proxy #1242

Excelsior9000 opened this issue Sep 2, 2022 · 1 comment

Comments

@Excelsior9000
Copy link

Excelsior9000 commented Sep 2, 2022

I try to use ThreadedWebsocketManager to start a stream on a Windows PC.
This PC is behind a http proxy.
No error, but no response....
did I do something wrong? or did I forget something?
Note: on this pc i don't have Administrative rights... (maybe I need them to change the enviroment variables..)

EDIT: i tried to start the same stream in a pc WITHOUT proxy and its work....

code:

from binance import ThreadedWebsocketManager
import os

proxy = "http://<username>:<password>@<proxyurl>:<port>"
os.environ['http_proxy'] = proxy
os.environ['HTTP_PROXY'] = proxy
os.environ['https_proxy'] = proxy
os.environ['HTTPS_PROXY'] = proxy

api_key = '<my api key>'
api_secret = '<my secrect key>'

def main():
    symbol = 'BTCUSDT'

    twm = ThreadedWebsocketManager(api_key=api_key, api_secret=api_secret)
    # start is required to initialise its internal loop
    twm.start()

    def handle_socket_message(msg):
        print(f"message type: {msg['e']}")
        print(msg)

    twm.start_kline_socket(callback=handle_socket_message, symbol=symbol)
    twm.join()


if __name__ == "__main__":
   main()

@Enebz
Copy link
Contributor

Enebz commented Sep 2, 2022

I am also having this issue as i posted in Issue #1243

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

No branches or pull requests

2 participants