mirror of
https://github.com/curly60e/pyblock.git
synced 2026-08-20 13:28:10 +02:00
Merge pull request #9 from curly60e/curly60e-patch-5
Fixes and Donation QRCode
This commit is contained in:
commit
c6b47fcb8c
1 changed files with 38 additions and 5 deletions
43
apisnd.py
43
apisnd.py
|
|
@ -1,5 +1,7 @@
|
|||
import os
|
||||
import qrcode
|
||||
import requests
|
||||
import time as t
|
||||
|
||||
def apisender():
|
||||
qr = qrcode.QRCode(
|
||||
|
|
@ -11,8 +13,10 @@ def apisender():
|
|||
url = 'https://api.blockstream.space/order'
|
||||
message = input("\nInsert your Message: ")
|
||||
sentby = "... Message sent from PyBlock."
|
||||
print("ATENTION: Minimum amount for sending a text is 5000 MSats")
|
||||
amountmsat = input("\nInsert the amount in MSats: ")
|
||||
curl = 'curl -F ' "bid={} ".format(amountmsat) + '-F ' + ' "message=' + message + sentby + '" ' + url
|
||||
|
||||
curl = 'curl -F "bid=10000" -F ' + ' "message=' + message + sentby + '" ' + url
|
||||
sh = os.popen(str(curl)).read()
|
||||
shh = sh.split(',')
|
||||
invoice = str(shh[6])
|
||||
|
|
@ -47,7 +51,9 @@ def apisender():
|
|||
qr.print_ascii()
|
||||
print("\033[0;37;40m")
|
||||
print("\nLND Invoice: " + cln + "\n")
|
||||
print(cln)
|
||||
t.sleep(50)
|
||||
devAddr()
|
||||
|
||||
|
||||
def apisenderFile():
|
||||
qr = qrcode.QRCode(
|
||||
|
|
@ -58,8 +64,9 @@ def apisenderFile():
|
|||
)
|
||||
url = 'https://api.blockstream.space/order'
|
||||
message = input("\nInsert the path to the File: ")
|
||||
|
||||
curl = 'curl -F "bid=50000" -F ' + ' "file=@' + message + '" ' + url
|
||||
print("ATENTION: Minimum amount for sending a File is 50000 MSats")
|
||||
amountmsat = input("\nInsert the amount in MSats: ")
|
||||
curl = 'curl -F ' "bid={} ".format(amountmsat) + '-F ' + ' "file=@' + message + '" ' + url
|
||||
sh = os.popen(str(curl)).read()
|
||||
shh = sh.split(',')
|
||||
invoice = str(shh[6])
|
||||
|
|
@ -94,6 +101,32 @@ def apisenderFile():
|
|||
qr.print_ascii()
|
||||
print("\033[0;37;40m")
|
||||
print("\nLND Invoice: " + cln)
|
||||
print(cln)
|
||||
t.sleep(50)
|
||||
devAddr()
|
||||
|
||||
def devAddr():
|
||||
qr = qrcode.QRCode(
|
||||
version=1,
|
||||
error_correction=qrcode.constants.ERROR_CORRECT_L,
|
||||
box_size=10,
|
||||
border=4,
|
||||
)
|
||||
print("\n\t\t\033[1;33;44mGive us some love and \033[1;31;44mDONATE\033[1;33;44m us! We will appreciate it. This will be a boost to continue this beautiful project! \033[0;37;40m")
|
||||
url = 'https://api.tippin.me/v1/public/addinvoice/royalfield370'
|
||||
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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue