1234567891011121314151617181920212223242526 |
- extends HTTPRequest
- var kinds = {
- "height": "http://imbrium.mit.edu/DATA/SLDEM2015/TILES/FLOAT_IMG/%s",
- "color": ""
- }
- func ensureFolder(kind):
- var dir = Directory.new()
- dir.open("user://")
- if not dir.dir_exists(kind):
- dir.make_dir(kind)
- func load(file, kind):
- if not kinds.has(kind):
- print("don't know kind %s"%kind)
- return
-
- ensureFolder(kind)
- var url = kinds[kind]%file
- download_file = "user://%s/%s".format([kind, file])
- # Perform a GET request.
- var error = request(url)
- if error != OK:
- push_error("An error occurred in the HTTP request.")
|