mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-25 07:07:46 +01:00
add Python3+ compatibility
This commit is contained in:
parent
bf480bd721
commit
773fae33ad
1 changed files with 26 additions and 6 deletions
|
@ -1,9 +1,29 @@
|
||||||
# parameter #1: password c to unlock wallet
|
# parameter #1: password c to unlock wallet
|
||||||
import base64, codecs, json, requests, sys
|
import base64
|
||||||
|
import codecs
|
||||||
|
import json
|
||||||
|
import requests
|
||||||
|
import sys
|
||||||
|
|
||||||
|
pw = sys.argv[1]
|
||||||
|
|
||||||
url = 'https://localhost:8080/v1/unlockwallet'
|
url = 'https://localhost:8080/v1/unlockwallet'
|
||||||
cert_path = '/mnt/hdd/lnd/tls.cert'
|
cert_path = '/mnt/hdd/lnd/tls.cert'
|
||||||
data = {
|
|
||||||
'wallet_password': base64.b64encode(sys.argv[1]).decode()
|
try:
|
||||||
}
|
pw_b64 = base64.b64encode(pw).decode()
|
||||||
|
except TypeError: # for Python3+
|
||||||
|
pw_b64 = base64.b64encode(pw.encode()).decode('UTF-8')
|
||||||
|
|
||||||
|
data = {'wallet_password': pw_b64}
|
||||||
|
try:
|
||||||
r = requests.post(url, verify=cert_path, data=json.dumps(data))
|
r = requests.post(url, verify=cert_path, data=json.dumps(data))
|
||||||
|
except requests.exceptions.ConnectionError as err:
|
||||||
|
print(err)
|
||||||
|
print("\nAn Error occurred - is LND running?")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if r.status_code == 404:
|
||||||
|
print("Already unlocked!")
|
||||||
|
else:
|
||||||
print(r.json())
|
print(r.json())
|
Loading…
Add table
Reference in a new issue