base64 dns key

This commit is contained in:
Kload 2013-07-07 12:30:00 +02:00
parent 5d9d87f20d
commit 12b399c6d9

View file

@ -28,6 +28,7 @@ import sys
import requests
import json
import glob
import base64
from yunohost import YunoHostError, YunoHostLDAP, validate, colorize, win_msg
def dyndns_subscribe(subscribe_host="dyndns.yunohost.org", domain=None, key=None):
@ -59,7 +60,7 @@ def dyndns_subscribe(subscribe_host="dyndns.yunohost.org", domain=None, key=None
raise YunoHostError(17, _("Domain is already taken"))
# Send subscription
r = requests.post('http://'+ subscribe_host +'/key/'+ key, data={ 'subdomain': domain })
r = requests.post('http://'+ subscribe_host +'/key/'+ base64.b64encode(key), data={ 'subdomain': domain })
if r.status_code != 201:
error = json.loads(r.text)['error']
raise YunoHostError(1, _("An error occured during DynDNS registration: "+ error))