commit 6176ef59c1a438db004a20f1b2513224c60b3cb3 Author: Alex Kelly Date: Fri Jan 3 15:00:44 2020 -0500 initial checkin diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1ecf205 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +layout virtualenvwrapper chainlink diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/chainlink.py b/chainlink.py new file mode 100755 index 0000000..bb1a6c6 --- /dev/null +++ b/chainlink.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +"""Utilize crypto domains DNS and either redirect, or display information.""" +from flask import Flask, redirect, url_for +import json +import requests + +VERSION = '0.0.1' + +app = Flask(__name__) + + +@app.route("/") +def root(): + return 'There is nothing here' + + +@app.route("/") +def showdomain(domain): + redirect = requests.get(f'https://unstoppabledomains.com/api/v1/{domain}') + if redirect.status_code == 200: + body = json.loads(redirect.content) + redirect_url = body['ipfs']['redirect_domain'] + return f'

' + +if __name__ == "__main__": + app.run()