mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-26 17:24:38 +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
|
||||
|
||||
import urlparse
|
||||
import os, urllib, urlparse
|
||||
import scrapy
|
||||
from scrapy.command import ScrapyCommand
|
||||
from scrapy.spider import spiders
|
||||
@ -60,6 +60,11 @@ class Command(ScrapyCommand):
|
||||
|
||||
def get_url(self, 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'):
|
||||
print "Unsupported scheme '%s' in URL: <%s>" % (u.scheme, url)
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user