Make the Directory constructor use requests

master
Sven Slootweg 12 years ago
parent e196a782fc
commit 57b9c5e187

@ -1,4 +1,4 @@
import json, time, os, re, requests import json, time, os, re, requests, urllib
try: try:
from fs.contrib.tahoelafs import TahoeLAFS from fs.contrib.tahoelafs import TahoeLAFS
@ -126,8 +126,11 @@ class Directory:
self.filesystem = filesystem self.filesystem = filesystem
self.uri = uri self.uri = uri
if data == None: if data is None:
data = self.filesystem.standard_request("uri/%s" % urllib.quote(uri)) data = requests.get("%s/uri/%s" % (this.filesystem.url, urllib.quote(uri))).json
if data is None:
raise FilesystemException("Could not reach the WAPI or did not receive a valid response.")
if "dirnode" in data: if "dirnode" in data:
details = data[1] details = data[1]

Loading…
Cancel
Save