Exemple #1
0
    def price(cls, currency="RPD"):
        slugs = {"RPD": "rapids", "PRCY": "prcy-coin", "DAPS": "daps-token"}

        if currency not in slugs:
            return utils.dead_response("Currency not found")

        slug = slugs[currency]
        link = f"https://api.coingecko.com/api/v3/simple/price?ids={slug}&vs_currencies=usd,btc,gbp,eur"
        data = requests.get(link).json()

        return utils.response({
            "usd": str(data[slug]["usd"]),
            "btc": str(data[slug]["btc"]),
            "gbp": str(data[slug]["gbp"]),
            "eur": str(data[slug]["eur"])
        })
Exemple #2
0
def page_404(error):
    return jsonify(utils.dead_response('Method not found'))
def page_404(error):
    return jsonify(
        utils.dead_response(
            'Incorrect path. Please check http://api.beyondcoin.io/'))