port client/server to python3
This commit is contained in:
parent
d222dff214
commit
4781c35643
2 changed files with 5 additions and 5 deletions
|
@ -33,13 +33,12 @@ class DistributedClient:
|
|||
|
||||
def upload(self, oshash, path):
|
||||
url = '%s/upload/%s' % (self.url, oshash)
|
||||
with open(path) as f:
|
||||
with open(path, 'rb') as f:
|
||||
requests.put(url, f)
|
||||
|
||||
def next(self):
|
||||
url = '%s/next' % self.url
|
||||
r = requests.get(url)
|
||||
data = r.json()
|
||||
data = requests.get(url).json()
|
||||
if 'oshash' in data:
|
||||
self.encode(data['oshash'], data['cmd'], data['output'])
|
||||
return True
|
||||
|
|
|
@ -8,6 +8,7 @@ import shutil
|
|||
import time
|
||||
try:
|
||||
import _thread as thread
|
||||
from queue import Queue
|
||||
except:
|
||||
import thread
|
||||
from Queue import Queue
|
||||
|
@ -74,7 +75,7 @@ class Server(Resource):
|
|||
def queued(self):
|
||||
site = self.client._config['url']
|
||||
files = self.client.get_encodes(site)
|
||||
available = filter(lambda oshash: self.is_available(oshash), files)
|
||||
available = list(filter(lambda oshash: self.is_available(oshash), files))
|
||||
unavailable = list(set(files) - set(available))
|
||||
return available, unavailable
|
||||
|
||||
|
|
Loading…
Reference in a new issue