Version 1 (modified by 13 years ago) ( diff ) | ,
---|
Create a wrapper to also allow scanbtable creation directly from a file on the web.
import urllib2 import tempfile from asap import scantable def urlscantable(*args, **kwargs): if isinstance(args[0], basestring) and args[0].startswith("http"): url = urllib2.urlopen(args[0]) tfile = tempfile.NamedTemporaryFile() tfile.write(url.read()) return scantable(tfile.name, *args[1:], **kwargs) else: return scantable(*args, **kwargs) if __name__ == "__main__": s = urlscantable("http://www.narrabri.atnf.csiro.au/mopra/DataDepot/2008-03-12_0932-M999.rp\ f") print s
Note:
See TracWiki
for help on using the wiki.