##// END OF EJS Templates
Allow loadpy to load remote URLs that don't end in .py
Fernando Perez -
Show More
@@ -2151,7 +2151,11 b' Currently the magic system has the following functions:\\n"""'
2151 %loadpy http://www.example.com/myscript.py
2151 %loadpy http://www.example.com/myscript.py
2152 """
2152 """
2153 arg_s = unquote_filename(arg_s)
2153 arg_s = unquote_filename(arg_s)
2154 if not arg_s.endswith('.py'):
2154 if not arg_s.startswith(('http://', 'https://')) \
2155 and not arg_s.endswith('.py'):
2156 # Local files must be .py; for remote URLs it's possible that the
2157 # fetch URL doesn't have a .py in it (many servers have an opaque
2158 # URL, such as scipy-central.org).
2155 raise ValueError('%%load only works with .py files: %s' % arg_s)
2159 raise ValueError('%%load only works with .py files: %s' % arg_s)
2156 if arg_s.startswith('http'):
2160 if arg_s.startswith('http'):
2157 import urllib2
2161 import urllib2
General Comments 0
You need to be logged in to leave comments. Login now