@@ -169,8 +169,9 @@ async def get_decoded(self, bolt11: str):
169
169
try :
170
170
decode_url = self ._lnbits_url + self .paypath + "/decode"
171
171
payload = {"data" : bolt11 }
172
- # res = requests.post(decode_url, json=payload, headers=self._invoice_headers)
173
- res = await post_url (self ._session , path = decode_url , body = payload , headers = self ._invoice_headers )
172
+ j = json .dumps (payload )
173
+ #res = requests.post(decode_url, json=payload, headers=self._invoice_headers)
174
+ res = await post_url (self ._session , path = decode_url , body = j , headers = self ._invoice_headers )
174
175
return res
175
176
except Exception as e :
176
177
print ("Exception in get_decoded() " , e )
@@ -181,8 +182,7 @@ async def get_payhash(self, bolt11: str):
181
182
"""
182
183
Only returns the payment hash not entire decoded invoice
183
184
"""
184
- res = await self .get_decoded (bolt11 )
185
- decoded = res .json ()
185
+ decoded = await self .get_decoded (bolt11 )
186
186
# print(decoded)
187
187
if "payment_hash" in decoded :
188
188
payhash = decoded ["payment_hash" ]
@@ -255,18 +255,16 @@ async def get_bolt11(self, email: str, amount: int):
255
255
"""
256
256
try :
257
257
purl = self .get_payurl (email )
258
- res = await get_url (self ._session , path = purl , headers = self ._invoice_headers )
258
+ json_content = await get_url (self ._session , path = purl , headers = self ._invoice_headers )
259
259
# res = requests.get(purl)
260
- json_content = res .json ()
261
260
lnurlpay = json_content ["callback" ]
262
261
263
262
millisats = amount * 1000
264
263
payquery = lnurlpay + "?amount=" + str (millisats )
265
264
266
265
# get bech32-serialized lightning invoice
267
- # ln_res = requests.get(payquery)
268
- ln_res = await get_url (self ._session , path = payquery , headers = self ._invoice_headers )
269
- pr_dict = ln_res .json ()
266
+ # pr_dict = requests.get(payquery)
267
+ pr_dict = await get_url (self ._session , path = payquery , headers = self ._invoice_headers )
270
268
# check keys returned for status
271
269
if "status" in pr_dict :
272
270
reason = pr_dict ["reason" ]
@@ -278,4 +276,4 @@ async def get_bolt11(self, email: str, amount: int):
278
276
print ("Exception as: " , str (e ))
279
277
return e
280
278
281
- # get lnbits pay_id from lightning address if its a lnpayurl
279
+ # get lnbits pay_id from lightning address if its a lnpayurl
0 commit comments