port client/server to python3

This commit is contained in:
j 2017-06-30 17:38:49 +02:00
parent d222dff214
commit 4781c35643
2 changed files with 5 additions and 5 deletions

View File

@ -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

View File

@ -8,9 +8,10 @@ import shutil
import time
try:
import _thread as thread
from queue import Queue
except:
import thread
from Queue import Queue
from Queue import Queue
from threading import Thread
import ox
@ -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