mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-26 21:04:34 +00:00
applied Patrick Mézard patch for loading local files
--HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40777
This commit is contained in:
parent
ce1700dd8e
commit
57189e1b92
@ -1,6 +1,6 @@
|
|||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
|
|
||||||
import urlparse
|
import os, urllib, urlparse
|
||||||
import scrapy
|
import scrapy
|
||||||
from scrapy.command import ScrapyCommand
|
from scrapy.command import ScrapyCommand
|
||||||
from scrapy.spider import spiders
|
from scrapy.spider import spiders
|
||||||
@ -60,6 +60,11 @@ class Command(ScrapyCommand):
|
|||||||
|
|
||||||
def get_url(self, url):
|
def get_url(self, url):
|
||||||
u = urlparse.urlparse(url)
|
u = urlparse.urlparse(url)
|
||||||
|
if not u.scheme:
|
||||||
|
path = os.path.abspath(url).replace(os.sep, '/')
|
||||||
|
url = 'file://' + urllib.pathname2url(path)
|
||||||
|
u = urlparse.urlparse(url)
|
||||||
|
|
||||||
if u.scheme not in ('http', 'https', 'file'):
|
if u.scheme not in ('http', 'https', 'file'):
|
||||||
print "Unsupported scheme '%s' in URL: <%s>" % (u.scheme, url)
|
print "Unsupported scheme '%s' in URL: <%s>" % (u.scheme, url)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user