operatorequals/httpimport

Importing non-packages?

ihamburglar opened this issue · 3 comments

I have a large number of non-package(i.e. single file) libraries to pull in. The documentation seems to focus a lot on packages. Is there a way to pull them in without converting them to packages?

Actually I think this is due to https://github.com/operatorequals/httpimport/blob/master/httpimport.py#L123. Seems to work better with just "except:"

Seems like a bug here! Can you provide me your testing module URL?

I can't seem to reproduce the issue with modules myself:

The setup
/tmp$ echo 'def test():return 1' >> mod.py
/tmp$ python -m SimpleHTTPServer 
Serving HTTP on 0.0.0.0 port 8000 ...
The script
Python 3.5.4 (default, Aug 12 2017, 14:08:14) 
[GCC 7.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import httpimport
>>> 
>>> httpimport.INSECURE = True
>>> mod = httpimport.load('mod')     # defaults to 'http://localhost:8000/'
[!] Using non HTTPS URLs ('http://localhost:8000//') can be a security hazard!
>>> mod.test()
1
>>>