7

When I make an HTTPS request using the aiohttp library with asyncio and Python 3.4 in Windows 7, the request fails with a NotImplementedError in the _make_ssl_transport function in base_events.py as shown in the traceback.

On Windows, I use the ProactorEventLoop. I think you have to use that one to get asyncio to work. I tried the same request in a Debian 7 VM with a compiled version of Python 3.4, and the same request works. I don't use the ProactorEventLoop in Debian, just the default though.

Any ideas or workarounds? Or, should I give up with aiohttp HTTPS on Windows for now? I am not able to use Linux for this project, needs to be on Windows.

jfs
  • 399,953
  • 195
  • 994
  • 1,670
greenaj
  • 163
  • 1
  • 8
  • 1
    you need `ProactorEventLoop()` to [read output from subprocesses' pipes using `asyncio`](http://stackoverflow.com/a/20697159/4279). Try the default loop (remove set_event_loop() calls) to make https requests instead. – jfs Apr 21 '14 at 20:47
  • That seems to work, but the only problem is that when I close the loop, I always get an exception, even when there are not more pending tasks. – greenaj Apr 22 '14 at 18:38
  • 1
    it just means that there are more than one issue in your code. Create a [minimal complete code example](http://stackoverflow.com/help/mcve) and [post it as a question](http://stackoverflow.com/questions/ask) – jfs Apr 22 '14 at 22:16
  • @J.F.Sebastian - your earlier comment about using the default event loop works for HTTPS on Windows, thanks. The ProactorEventLoop just does not seem to work. I guess I need 2 loops if running shell commands and HTTP(S) request in Python on Windows. – greenaj Apr 25 '14 at 02:46
  • 1
    you could [post your comment as an answer and accept it](http://stackoverflow.com/help/self-answer): 1. ProactorEventLoop is incompatible with SSL 2. The default loop supports SSL on Windows and by extension aiohttp should also work with https on Windows. – jfs May 05 '14 at 14:28

1 Answers1

0

As jfs and OP observe,

  1. ProactorEventLoop is incompatible with SSL, and
  2. The default loop supports SSL on Windows. By extension aiohttp should also work with https on Windows.
J_H
  • 17,926
  • 4
  • 24
  • 44