Merge pull request #50 from curly60e/curly60e-patch-37

v0.5.0-beta Api improvement
This commit is contained in:
curly60e 2020-06-22 20:58:49 -03:00 committed by GitHub
commit 30ffe79cd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 116 additions and 18 deletions

View file

@ -374,19 +374,24 @@ def APIMenu():
\033[1;31;40mPyBLOCK\033[0;37;40m API \033[1;34;40mPremium\033[0;37;40m Menu
Version 0.5.0
\033[1;32;40mA.\033[0;37;40m LNBits
\033[1;32;40mB.\033[0;37;40m LNPay
\033[1;32;40mC.\033[0;37;40m OpenNode
\033[1;32;40mA.\033[0;37;40m TippinMe FREE
\033[1;32;40mB.\033[0;37;40m LNBits \033[3;35;40m{lnbitspaid}\033[0;37;40m
\033[1;32;40mC.\033[0;37;40m LNPay \033[3;35;40m{lnpaypaid}\033[0;37;40m
\033[1;32;40mD.\033[0;37;40m OpenNode \033[3;35;40m{opennodepaid}\033[0;37;40m
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
\n\n""".format(lnbitspaid = "PAID" if os.path.isfile("lnbitSN.conf") else "PREMIUM", lnpaypaid = "PAID" if os.path.isfile("lnpaySN.conf") else "PREMIUM", opennodepaid = "PAID" if os.path.isfile("opennodeSN.conf") else "PREMIUM"))
menuPI(input("\033[1;32;40mSelect option: \033[0;37;40m"))
def APILnbit():
bitLN = {"NN":"","pd":""}
if os.path.isfile('lnbitSN.conf'): # Check if the file 'bclock.conf' is in the same folder
bitData= pickle.load(open("lnbitSN.conf", "rb")) # Load the file 'bclock.conf'
bitLN = bitData # Copy the variable pathv to 'path'
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m LNBits \033[1;34;40mPremium\033[0;37;40m Menu
\033[1;31;40mPyBLOCK\033[0;37;40m LNBits SN:{} \033[1;34;40mPremium\033[0;37;40m Menu
Version 0.5.0
\033[1;32;40mA.\033[0;37;40m New Invoice
@ -395,15 +400,19 @@ def APILnbit():
\033[1;32;40mD.\033[0;37;40m Delete PayWall
\033[1;32;40mE.\033[0;37;40m List PayWalls
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
\n\n""".format(bitLN['NN']))
menuLNBPI(input("\033[1;32;40mSelect option: \033[0;37;40m"))
def APILnPay():
bitLN = {"NN":"","pd":""}
if os.path.isfile('lnpaySN.conf'): # Check if the file 'bclock.conf' is in the same folder
bitData= pickle.load(open("lnpaySN.conf", "rb")) # Load the file 'bclock.conf'
bitLN = bitData # Copy the variable pathv to 'path'
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m LNPay \033[1;34;40mPremium\033[0;37;40m Menu
\033[1;31;40mPyBLOCK\033[0;37;40m LNPay SN:{} \033[1;34;40mPremium\033[0;37;40m Menu
Version 0.5.0
\033[1;32;40mA.\033[0;37;40m New Invoice
@ -412,15 +421,19 @@ def APILnPay():
\033[1;32;40mD.\033[0;37;40m List Invoices
\033[1;32;40mE.\033[0;37;40m Transfer Between Wallets
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
\n\n""".format(bitLN['NN']))
menuLNPAY(input("\033[1;32;40mSelect option: \033[0;37;40m"))
def APIOpenNode():
bitLN = {"NN":"","pd":""}
if os.path.isfile('opennodeSN.conf'): # Check if the file 'bclock.conf' is in the same folder
bitData= pickle.load(open("opennodeSN.conf", "rb")) # Load the file 'bclock.conf'
bitLN = bitData # Copy the variable pathv to 'path'
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m OpenNode \033[1;34;40mPremium\033[0;37;40m Menu
\033[1;31;40mPyBLOCK\033[0;37;40m OpenNode SN:{} \033[1;34;40mPremium\033[0;37;40m Menu
Version 0.5.0
\033[1;32;40mA.\033[0;37;40m New Invoice
@ -428,9 +441,22 @@ def APIOpenNode():
\033[1;32;40mC.\033[0;37;40m Wallet Balance
\033[1;32;40mD.\033[0;37;40m List Payments
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
\n\n""".format(bitLN['NN']))
menuOpenNode(input("\033[1;32;40mSelect option: \033[0;37;40m"))
def APITippinMe():
clear()
prt()
sysinfo()
print("""\t\t
\033[1;31;40mPyBLOCK\033[0;37;40m TippinMe \033[1;34;40mFree\033[0;37;40m Menu
Version 0.5.0
\033[1;32;40mA.\033[0;37;40m New Invoice
\033[1;36;40mR.\033[0;37;40m Return Main Menu
\n\n""")
menuTippinMe(input("\033[1;32;40mSelect option: \033[0;37;40m"))
def menuSelection():
path = {"ip_port":"", "rpcuser":"", "rpcpass":"", "bitcoincli":""}
pathv = pickle.load(open("bclock.conf", "rb")) # Load the file 'bclock.conf'
@ -451,9 +477,9 @@ def menuSelectionLN():
def aaccPPiLNBits():
bitLN = {"NN":"","pd":""}
if os.path.isfile('lnbitSN.conf'): # Check if the file 'bclock.conf' is in the same folder
bitData= pickle.load(open("lnbitSN.conf", "rb")) # Load the file 'bclock.conf'
bitLN = bitData # Copy the variable pathv to 'path'
if os.path.isfile('lnbitSN.conf'):
bitData= pickle.load(open("lnbitSN.conf", "rb"))
bitLN = bitData
APILnbit()
else:
qr = qrcode.QRCode(
@ -589,17 +615,34 @@ def aaccPPiOpenNode():
break
else:
continue
def aaccPPiTippinMe():
bitLN = {"NN":"","pd":""}
if os.path.isfile('tippinme.conf'): # Check if the file 'bclock.conf' is in the same folder
bitData= pickle.load(open("tippinme.conf", "rb")) # Load the file 'bclock.conf'
bitLN = bitData # Copy the variable pathv to 'path'
APITippinMe()
else:
loadFileTippinMe()
#--------------------------------- End Menu section -----------------------------------
#--------------------------------- Main Menu execution --------------------------------
def menuPI(menuWN):
if menuWN == "A" or menuWN == "a":
aaccPPiLNBits()
aaccPPiTippinMe()
if menuWN == "B" or menuWN == "b":
aaccPPiLNPay()
aaccPPiLNBits()
if menuWN == "C" or menuWN == "c":
aaccPPiLNPay()
if menuWN == "D" or menuWN == "d":
aaccPPiOpenNode()
def menuTippinMe(menuTM):
if menuTM == "A" or menuTM == "a":
tippinmeGetInvoice()
if menuTM == "R" or menuTM == "r":
APIMenu()
def menuOpenNode(menuOP):
if menuOP == "A" or menuOP == "a":
clear()

61
ppi.py
View file

@ -8,6 +8,7 @@ import os
import os.path
import qrcode
import lnpay_py
import requests
import simplejson as json
import time as t
from art import *
@ -542,7 +543,7 @@ def lnpayTransBWallets():
#-----------------------------OPENNODE--------------------------------
def loadFileConnOpenNode(lnpayLoad):
def loadFileConnOpenNode(opennodeLoad):
opennodeLoad = {"key":"","wdr":"","inv":""}
if os.path.isfile('opennode.conf'): # Check if the file 'bclock.conf' is in the same folder
@ -551,10 +552,10 @@ def loadFileConnOpenNode(lnpayLoad):
else:
clear()
blogo()
print("""\n\t \033[1;33;40mATENTION\033[0;37;40m: YOU ARE GOING TO CREATE A FILE WITH YOUR INFORMATION OF CONNECTION TO LNPAY.CO.
print("""\n\t \033[1;33;40mATENTION\033[0;37;40m: YOU ARE GOING TO CREATE A FILE WITH YOUR INFORMATION OF CONNECTION TO OPENNODE.COM.
WE WILL NEED SOME INFORMATION FROM YOUR ACCOUNT THAT THE ONLY ONE THAT WILL HAVE ACCESS IS YOU.
IF YOU DELETE THIS FILE YOU WILL NEED TO PAY AGAIN TO GET ACCESS FROM PyBLOCK.
SAVE THE FILE '\033[1;33;40mlnpaySN.conf\033[0;37;40m' IN A SAFE PLACE.\n
SAVE THE FILE '\033[1;33;40mopennodeSN.conf\033[0;37;40m' IN A SAFE PLACE.\n
""")
opennodeLoad["key"] = input("API Read Only Key: ")
opennodeLoad["wdr"] = input("API Withdrawall Key: ")
@ -870,3 +871,57 @@ def OpenNodeListPayments():
except:
break
#-----------------------------END OPENNODE--------------------------------
#-----------------------------TIPPINME--------------------------------
def loadFileTippinMe(tippinmeLoad):
tippinmeLoad = {"key":""}
if os.path.isfile('tippinme.conf'): # Check if the file 'bclock.conf' is in the same folder
tippinmeData= pickle.load(open("tippinme.conf", "rb")) # Load the file 'bclock.conf'
tippinmeLoad = tippinmeData # Copy the variable pathv to 'path'
else:
clear()
blogo()
print("""\n\t \033[1;33;40mATENTION\033[0;37;40m: YOU ARE GOING TO CREATE A FILE WITH YOUR INFORMATION OF CONNECTION TO TIPPIN.ME.
WE WILL NEED SOME INFORMATION FROM YOUR ACCOUNT THAT THE ONLY ONE THAT WILL HAVE ACCESS IS YOU.
IF YOU DELETE THIS FILE YOU WILL NEED TO PAY AGAIN TO GET ACCESS FROM PyBLOCK.
SAVE THE FILE '\033[1;33;40mtippinmeSN.conf\033[0;37;40m' IN A SAFE PLACE.\n
""")
tippinmeLoad["key"] = input("Twitter @user: ")
pickle.dump(tippinmeLoad, open("tippinme.conf", "wb"))
clear()
blogo()
return tippinmeLoad
def tippinmeGetInvoice():
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
a = loadFileTippinMe(['key'])
b = str(a['key'])
url = 'https://api.tippin.me/v1/public/addinvoice/{}'.format(b)
response = requests.get(url)
responseB = str(response.text)
responseC = responseB
lnreq = responseC.split(',')
lnbc1 = lnreq[1]
lnbc1S = str(lnbc1)
lnbc1R = lnbc1S.split(':')
lnbc1W = lnbc1R[1]
ln = str(lnbc1W)
ln1 = ln.strip('"')
print("\033[1;30;47m")
qr.add_data(ln1)
qr.print_ascii()
print("\033[0;37;40m")
print("LND Invoice: " + ln1)
response.close()
input("Continue...")
#-----------------------------END TIPPINME--------------------------------