Commit ac25bf0c authored by Łukasz Nowak's avatar Łukasz Nowak

Simplify.

Note: Soon the best *one* module will be selected.
parent 86578896
...@@ -20,7 +20,6 @@ import json ...@@ -20,7 +20,6 @@ import json
import os import os
import tempfile import tempfile
import urllib import urllib
import urllib2
import urlparse import urlparse
import M2Crypto import M2Crypto
import socket import socket
...@@ -159,14 +158,10 @@ class NetworkcacheClient(object): ...@@ -159,14 +158,10 @@ class NetworkcacheClient(object):
Raise DirectoryNotFound if multiple files are found. Raise DirectoryNotFound if multiple files are found.
''' '''
url = os.path.join(self.shadir_url, urlmd5) url = os.path.join(self.shadir_url, urlmd5)
request = urllib2.Request(url=url, data=None, file_descriptor = tempfile.NamedTemporaryFile()
headers=self.shadir_header_dict) path, headers = urllib.urlretrieve(url, file_descriptor.name)
try: file_descriptor.seek(0)
result = urllib2.urlopen(request) data = file_descriptor.read()
data = result.read()
except urllib2.HTTPError, error:
raise DirectoryNotFound("%s : %s" % (error.code, error.msg))
# Filtering... # Filtering...
data_list = json.loads(data) data_list = json.loads(data)
if len(data_list) > 1 and not \ if len(data_list) > 1 and not \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment