3 from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, escape_path
4 from allmydata.scripts.common_http import do_http
7 nodeurl = options['node-url']
8 aliases = options.aliases
9 from_file = options.from_file
10 to_file = options.to_file
11 stdout = options.stdout
12 stderr = options.stderr
14 if nodeurl[-1] != "/":
16 rootcap, path = get_alias(aliases, from_file, DEFAULT_ALIAS)
17 url = nodeurl + "uri/%s" % urllib.quote(rootcap)
19 url += "/" + escape_path(path)
21 resp = do_http("GET", url)
22 if resp.status in (200, 201,):
24 outf = open(to_file, "wb")
28 data = resp.read(4096)
36 print >>stderr, "Error, got %s %s" % (resp.status, resp.reason)
37 print >>stderr, resp.read()