Skip to content

Commit 06efb63

Browse files
Naive implementation of scraperwiki.swimport().
This will look in the python path for a library with the name specified in swimport. Not quite like the original code, but it make it possible to place the old libraries in the path and get the old scraperwiki code working.
1 parent 024dbbf commit 06efb63

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

scraperwiki/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'''
88
from __future__ import absolute_import
99

10-
from .utils import scrape, pdftoxml, status
10+
from .utils import scrape, pdftoxml, status, swimport
1111
from . import utils
1212
from . import sql
1313

scraperwiki/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,6 @@ def status(type, message=None):
8080
r = requests.post(url, data={'type': type, 'message': message})
8181
r.raise_for_status()
8282
return r.content
83+
84+
def swimport(scrapername):
85+
return __import__(scrapername)

0 commit comments

Comments
 (0)