From 0c9cd481f624f7bc6d7581c6d2295daea0d4db02 Mon Sep 17 00:00:00 2001 From: Florent D'halluin Date: Tue, 5 Apr 2016 21:26:44 +0200 Subject: [PATCH] make travis install h2, and optionnal import PyOpenSSL --- .travis.yml | 2 +- daphne/server.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6f34248..3c6acac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,5 +5,5 @@ python: - "3.5" install: - if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install unittest2; fi - - pip install asgiref twisted autobahn + - pip install asgiref twisted autobahn h2 script: if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then python -m unittest2; else python -m unittest; fi diff --git a/daphne/server.py b/daphne/server.py index bac05b9..7eb321e 100755 --- a/daphne/server.py +++ b/daphne/server.py @@ -1,6 +1,5 @@ import logging from twisted.internet import reactor, ssl, endpoints -from OpenSSL import crypto from .http_protocol import HTTPFactory @@ -49,6 +48,9 @@ class Server(object): ) if self.ssl_certificate : + + from OpenSSL import crypto + with open(self.ssl_certificate, 'r') as f: cert = crypto.load_certificate(crypto.FILETYPE_PEM, f.read()) with open(self.ssl_key, 'r') as f: