urlencode data variable

master
Aaron 2018-11-13 21:04:14 +00:00
parent 851b2bef76
commit 1298e7cd7d
1 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
# Misc functions that do not fit in the main api, but are useful
import getpass, sys, requests, os, socket, hashlib, logger, sqlite3, config, binascii, time, base64, json, glob, shutil, math, json, re
import getpass, sys, requests, os, socket, hashlib, logger, sqlite3, config, binascii, time, base64, json, glob, shutil, math, json, re, urllib.parse
import nacl.signing, nacl.encoding
from onionrblockapi import Block
import onionrexceptions
@ -165,7 +165,7 @@ class OnionrUtils:
return False
payload = 'http://%s:%s/client/?action=%s&token=%s&timingToken=%s' % (hostname, config.get('client.port'), command, config.get('client.hmac'), self.timingToken)
if data != '':
payload += '&data=' + data
payload += '&data=' + urllib.parse.quote_plus(data)
try:
retData = requests.get(payload).text
except Exception as error: