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
import os
import tempfile
import urllib
import urllib2
import urlparse
import M2Crypto
import socket
......@@ -159,14 +158,10 @@ class NetworkcacheClient(object):
Raise DirectoryNotFound if multiple files are found.
'''
url = os.path.join(self.shadir_url, urlmd5)
request = urllib2.Request(url=url, data=None,
headers=self.shadir_header_dict)
try:
result = urllib2.urlopen(request)
data = result.read()
except urllib2.HTTPError, error:
raise DirectoryNotFound("%s : %s" % (error.code, error.msg))
file_descriptor = tempfile.NamedTemporaryFile()
path, headers = urllib.urlretrieve(url, file_descriptor.name)
file_descriptor.seek(0)
data = file_descriptor.read()
# Filtering...
data_list = json.loads(data)
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