Skip to content

Commit

Permalink
Merge pull request #1049 from scrapy/twisted-15-support
Browse files Browse the repository at this point in the history
Twisted 15.0.0 Support
  • Loading branch information
curita committed Feb 16, 2015
2 parents 7a745b1 + d67ca77 commit ee17902
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions scrapy/core/downloader/handlers/http11.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from scrapy.responsetypes import responsetypes
from scrapy.core.downloader.webclient import _parse
from scrapy.utils.misc import load_object
from scrapy import log
from scrapy import log, twisted_version


class HTTP11DownloadHandler(object):
Expand Down Expand Up @@ -142,10 +142,19 @@ def __init__(self, reactor, proxyConf, contextFactory=None,
self._proxyConf = proxyConf
self._contextFactory = contextFactory

def _getEndpoint(self, scheme, host, port):
return TunnelingTCP4ClientEndpoint(self._reactor, host, port,
self._proxyConf, self._contextFactory, self._connectTimeout,
self._bindAddress)
if twisted_version >= (15, 0, 0):
def _getEndpoint(self, uri):
return TunnelingTCP4ClientEndpoint(
self._reactor, uri.host, uri.port, self._proxyConf,
self._contextFactory, self._endpointFactory._connectTimeout,
self._endpointFactory._bindAddress)
else:
def _getEndpoint(self, scheme, host, port):
return TunnelingTCP4ClientEndpoint(
self._reactor, host, port, self._proxyConf,
self._contextFactory, self._connectTimeout,
self._bindAddress)



class ScrapyAgent(object):
Expand Down

0 comments on commit ee17902

Please sign in to comment.