mempool_api.py (1022B)
1 #!/usr/bin/env python3 2 # Copyright (C) 2020-2021 Ivan J. <parazyd@dyne.org> 3 # 4 # This file is part of obelisk 5 # 6 # This program is free software: you can redistribute it and/or modify 7 # it under the terms of the GNU Affero General Public License version 3 8 # as published by the Free Software Foundation. 9 # 10 # This program is distributed in the hope that it will be useful, 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 # GNU Affero General Public License for more details. 14 # 15 # You should have received a copy of the GNU Affero General Public License 16 # along with this program. If not, see <http://www.gnu.org/licenses/>. 17 """mempool.space API functions""" 18 import json 19 from http.client import HTTPSConnection 20 21 22 def get_mempool_fee_estimates(): 23 conn = HTTPSConnection("mempool.space") 24 conn.request("GET", "/api/v1/fees/recommended") 25 res = conn.getresponse() 26 27 if res.status != 200: 28 return None 29 30 return json.load(res)