topisani/Discurses

Allow the use of a proxy

Closed this issue · 4 comments

Im trying to run discurses behind a proxy
I tried configuring the https proxy in ubuntu but discurses just crashes

Ge0 commented

Hi.

Could you be more explicit about your problem? And paste here a few pointers about the crashes you might have got?

after discruses crashes the terminal becomes totally unresponsive.
i cant copy from the terminal

But thru the magic of virtual machines i got this crashlog

�
�
�
�
�
�
�
�                                          ░█▀▄░▀█▀░█▀▀░█▀▀░█░█░█▀▄░█▀▀░█▀▀░█▀▀
�                                          ░█░█░░█░░▀▀█░█░░░█░█░█▀▄░▀▀█░█▀▀░▀▀█
�                                          ░▀▀░░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀
�                                                                        v0.3.3
�
�
�                                           < Logging in... Hang tight! >
�                                            ---------------------------
�                                                   \   ^__^
�                                                    \  (oo)\_______
�                                                       (__)\       )\/\
�                                                           ||----w |
�                                                           ||     ||
�
�
�
�
�
�
�
�
�
�Traceback (most recent call last):
  File "/home/ccn/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 601, in _create_direct_connection
    local_addr=self._local_addr)
  File "/usr/lib/python3.6/asyncio/base_events.py", line 778, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.6/asyncio/base_events.py", line 765, in create_connection
    yield from self.sock_connect(sock, address)
  File "/usr/lib/python3.6/asyncio/selector_events.py", line 450, in sock_connect
    return (yield from fut)
  File "/usr/lib/python3.6/asyncio/selector_events.py", line 480, in _sock_connect_cb
    raise OSError(err, 'Connect call failed %s' % (address,))
ConnectionRefusedError: [Errno 111] Connect call failed ('104.16.59.5', 443)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ccn/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 304, in connect
    yield from self._create_connection(req)
  File "/home/ccn/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 578, in _create_connection
    transport, proto = yield from self._create_direct_connection(req)
  File "/home/ccn/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 624, in _create_direct_connection
    (req.host, req.port, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 111] Can not connect to discordapp.com:443 [Connect call failed ('104.16.59.5', 443)]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./discurses", line 11, in <module>
    sys.exit(main())
  File "/home/ccn/.local/lib/python3.6/site-packages/discurses/__main__.py", line 8, in main
    client.run()
  File "/home/ccn/.local/lib/python3.6/site-packages/discord/client.py", line 519, in run
    self.loop.run_until_complete(self.start(*args, **kwargs))
  File "/usr/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
    return future.result()
  File "/home/ccn/.local/lib/python3.6/site-packages/discord/client.py", line 490, in start
    yield from self.login(*args, **kwargs)
  File "/home/ccn/.local/lib/python3.6/site-packages/discurses/discord.py", line 67, in login
    await super().login(config.table['token'], bot=False)
  File "/home/ccn/.local/lib/python3.6/site-packages/discord/client.py", line 416, in login
    yield from getattr(self, '_login_' + str(n))(*args, **kwargs)
  File "/home/ccn/.local/lib/python3.6/site-packages/discord/client.py", line 346, in _login_1
    data = yield from self.http.static_login(token, bot=is_bot)
  File "/home/ccn/.local/lib/python3.6/site-packages/discord/http.py", line 258, in static_login
    data = yield from self.request(Route('GET', '/users/@me'))
  File "/home/ccn/.local/lib/python3.6/site-packages/discord/http.py", line 137, in request
    r = yield from self.session.request(method, url, **kwargs)
  File "/home/ccn/.local/lib/python3.6/site-packages/aiohttp/client.py", line 555, in __iter__
    resp = yield from self._coro
  File "/home/ccn/.local/lib/python3.6/site-packages/aiohttp/client.py", line 198, in _request
    conn = yield from self._connector.connect(req)
  File "/home/ccn/.local/lib/python3.6/site-packages/aiohttp/connector.py", line 314, in connect
    .format(key, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 111] Cannot connect to host discordapp.com:443 ssl:True [Can not connect to discordapp.com:443 [Connect call failed ('104.16.59.5', 443)]]
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/handlers.py", line 71, in emit
    if self.shouldRollover(record):
  File "/usr/lib/python3.6/logging/handlers.py", line 185, in shouldRollover
    self.stream = self._open()
  File "/usr/lib/python3.6/logging/__init__.py", line 1059, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
NameError: name 'open' is not defined
Call stack:
  File "/home/ccn/.local/lib/python3.6/site-packages/aiohttp/client.py", line 93, in __del__
    self._loop.call_exception_handler(context)
  File "/usr/lib/python3.6/asyncio/base_events.py", line 1291, in call_exception_handler
    self.default_exception_handler(context)
  File "/usr/lib/python3.6/asyncio/base_events.py", line 1266, in default_exception_handler
    logger.error('\n'.join(log_lines), exc_info=exc_info)
Message: 'Unclosed client session\nclient_session: <aiohttp.client.ClientSession object at 0x7f1067275be0>'
Arguments: ()`
Ge0 commented

As shown in the Traceback, this is not a discurses related bug, although it might be better for us to catch the exception and display a fancy message.

For now I don't think this is that relevant. I am closing the issue then.

I mean, is not a bug. but i would be helful to have a command to use a proxy