Commit 61ae45dc3ab8c5f7894a0a10682ad56e61383b12
1 parent
2283a2f3
Exists in
master
Atualiza endpoint do banco de sinais
Showing
2 changed files
with
18 additions
and
9 deletions
Show diff stats
corretor.py
... | ... | @@ -94,15 +94,23 @@ class Corretor: |
94 | 94 | video_url = ('http://%s/corretor/uploads/%s/%s.webm' % (api_host, user_id, sign_name)) |
95 | 95 | blend_downloaded = self.get_file(blend_url, blend_path) |
96 | 96 | video_downloaded = self.get_file(video_url, video_path) |
97 | - if (blend_downloaded and video_downloaded): | |
98 | - files_to_upload = [ ("video", (video_path, open(video_path,"rb"))), ("video", (blend_path, open(blend_path, "rb"))) ] | |
99 | - values = { "nome": sign_name, "selo": 5, "wikilibras": True, "overwrite": True } | |
100 | - r = requests.post(("%s/addsinal" % (api_dbhost)), files=files_to_upload, data=values) | |
101 | - pyutil.log("Request: " + str(r)) | |
102 | - pyutil.log(str(r.headers)) | |
103 | - shutil.rmtree(tmp_dir) | |
97 | + if (not blend_downloaded): | |
98 | + pyutil.log("blend file: %s was not downloaded" % (blend_url)) | |
99 | + elif (not video_downloaded): | |
100 | + pyutil.log("video file: %s was not downloaded" % (video_url)) | |
104 | 101 | else: |
105 | - pyutil.log("files: %s or %s was not downloaded" % (blend_url, video_url)) | |
102 | + files_to_upload = [ | |
103 | + ("video", (video_path, open(video_path,"rb"))), | |
104 | + ("video", (blend_path, open(blend_path, "rb"))) | |
105 | + ] | |
106 | + body = { | |
107 | + "nome": sign_name, | |
108 | + "idTask": task_id, | |
109 | + "selo": 5 | |
110 | + } | |
111 | + r = requests.post(("%s/updatesinal" % (api_dbhost)), files=files_to_upload, data=body) | |
112 | + pyutil.log(r.text) | |
113 | + shutil.rmtree(tmp_dir) | |
106 | 114 | result_msg = self.__close_task(project_id, task_id) |
107 | 115 | else: |
108 | 116 | result_msg = "The task with ID=" + str(task_id) + " didn't reach the agreement number yet." | ... | ... |
settings_local.py.tmpl
1 | 1 | # -*- coding: utf-8 -*- |
2 | + | |
2 | 3 | # Corretor Server Configuration |
3 | 4 | SERVER_HOST = "localhost" |
4 | 5 | SERVER_PORT = 8001 |
... | ... | @@ -14,7 +15,7 @@ APACHE_STATIC_FILES_ENDPOINT = "/corretor" |
14 | 15 | |
15 | 16 | # PyBossa Configuration |
16 | 17 | PYBOSSA_APP_NAME = "Corretor de Sinais" |
17 | -PYBOSSA_APP_SHORT_NAME = "corretor_sinais" | |
18 | +PYBOSSA_APP_SHORT_NAME = "corretor_sinais" | |
18 | 19 | PYBOSSA_APP_DESCRIPTION = "Esse projeto ajudará a comunidade a melhorar sinais com movimentos complexos." |
19 | 20 | PYBOSSA_ENDPOINT = "http://localhost/pybossa" |
20 | 21 | PYBOSSA_API_KEY = "my-api-key" |
21 | 22 | \ No newline at end of file | ... | ... |