labels: use https, and fix force param
This commit is contained in:
parent
973f7f9fe5
commit
659301873c
|
@ -145,7 +145,7 @@ class Plugin(BasePlugin):
|
||||||
self.upload = ThreadedButton("Force upload", self.push_thread, self.done_processing)
|
self.upload = ThreadedButton("Force upload", self.push_thread, self.done_processing)
|
||||||
layout.addWidget(self.upload, 2, 1)
|
layout.addWidget(self.upload, 2, 1)
|
||||||
|
|
||||||
self.download = ThreadedButton("Force download", self.pull_thread, self.done_processing)
|
self.download = ThreadedButton("Force download", lambda: self.pull_thread(True), self.done_processing)
|
||||||
layout.addWidget(self.download, 2, 2)
|
layout.addWidget(self.download, 2, 2)
|
||||||
|
|
||||||
self.accept = OkButton(d, _("Done"))
|
self.accept = OkButton(d, _("Done"))
|
||||||
|
@ -167,7 +167,7 @@ class Plugin(BasePlugin):
|
||||||
QMessageBox.information(None, _("Labels synchronised"), _("Your labels have been synchronised."))
|
QMessageBox.information(None, _("Labels synchronised"), _("Your labels have been synchronised."))
|
||||||
|
|
||||||
def do_request(self, method, is_batch=False, data=None):
|
def do_request(self, method, is_batch=False, data=None):
|
||||||
url = 'http://' + self.target_host + "/api/wallets/%s/%s?auth_token=%s" % (self.wallet_id, 'labels/batch.json' if is_batch else 'labels.json', self.auth_token())
|
url = 'https://' + self.target_host + "/api/wallets/%s/%s?auth_token=%s" % (self.wallet_id, 'labels/batch.json' if is_batch else 'labels.json', self.auth_token())
|
||||||
kwargs = {'headers': {}}
|
kwargs = {'headers': {}}
|
||||||
if method == 'GET' and data:
|
if method == 'GET' and data:
|
||||||
kwargs['params'] = data
|
kwargs['params'] = data
|
||||||
|
@ -192,9 +192,7 @@ class Plugin(BasePlugin):
|
||||||
print_error('cannot encode', repr(key), repr(value))
|
print_error('cannot encode', repr(key), repr(value))
|
||||||
continue
|
continue
|
||||||
bundle["labels"][encoded_key] = encoded_value
|
bundle["labels"][encoded_key] = encoded_value
|
||||||
|
self.do_request("POST", True, bundle)
|
||||||
response = self.do_request("POST", True, bundle)
|
|
||||||
self.window.emit(SIGNAL('labels:pushed'))
|
|
||||||
|
|
||||||
def pull_thread(self, force = False):
|
def pull_thread(self, force = False):
|
||||||
response = self.do_request("GET")
|
response = self.do_request("GET")
|
||||||
|
|
Loading…
Reference in New Issue