mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-09-29 03:03:50 +02:00
update coinstatsapi (requires api key now)
This commit is contained in:
@@ -17,7 +17,7 @@ LIBRE_TRANSLATE_API_KEY = "" # API Key, if required (You can host your own inst
|
|||||||
REPLICATE_API_TOKEN = "" #API Key to run models on replicate.com
|
REPLICATE_API_TOKEN = "" #API Key to run models on replicate.com
|
||||||
HUGGINGFACE_EMAIL = ""
|
HUGGINGFACE_EMAIL = ""
|
||||||
HUGGINGFACE_PASSWORD = ""
|
HUGGINGFACE_PASSWORD = ""
|
||||||
|
COINSTATSOPENAPI_KEY = ""
|
||||||
|
|
||||||
# We will automatically create dtags and private keys based on the identifier variable in main.
|
# We will automatically create dtags and private keys based on the identifier variable in main.
|
||||||
# If your DVM already has a dtag and private key you can replace it here before publishing the DTAG to not create a new one.
|
# If your DVM already has a dtag and private key you can replace it here before publishing the DTAG to not create a new one.
|
||||||
|
@@ -290,13 +290,17 @@ def zaprequest(lud16: str, amount: int, content, zapped_event, zapped_user, keys
|
|||||||
def get_price_per_sat(currency):
|
def get_price_per_sat(currency):
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
url = "https://api.coinstats.app/public/v1/coins"
|
url = "https://openapiv1.coinstats.app/coins/bitcoin"
|
||||||
params = {"skip": 0, "limit": 1, "currency": currency}
|
params = {"skip": 0, "limit": 1, "currency": currency}
|
||||||
|
price_currency_per_sat = 0.0004
|
||||||
|
if os.getenv("COINSTATSOPENAPI_KEY"):
|
||||||
|
|
||||||
|
header = {'accept': 'application/json', 'X-API-KEY': os.getenv("COINSTATSOPENAPI_KEY")}
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, params=params)
|
response = requests.get(url, headers=header, params=params)
|
||||||
response_json = response.json()
|
response_json = response.json()
|
||||||
|
|
||||||
bitcoin_price = response_json["coins"][0]["price"]
|
bitcoin_price = response_json["price"]
|
||||||
price_currency_per_sat = bitcoin_price / 100000000.0
|
price_currency_per_sat = bitcoin_price / 100000000.0
|
||||||
except:
|
except:
|
||||||
price_currency_per_sat = 0.0004
|
price_currency_per_sat = 0.0004
|
||||||
|
2
setup.py
2
setup.py
@@ -1,6 +1,6 @@
|
|||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
VERSION = '0.2.3'
|
VERSION = '0.2.4'
|
||||||
DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines'
|
DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines'
|
||||||
LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. '
|
LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. '
|
||||||
'This is an early stage release. Interfaces might change/brick')
|
'This is an early stage release. Interfaces might change/brick')
|
||||||
|
Reference in New Issue
Block a user