initial checkin

This commit is contained in:
Alex Kelly 2020-01-03 15:00:44 -05:00
commit 6176ef59c1
3 changed files with 28 additions and 0 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
layout virtualenvwrapper chainlink

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.idea

26
chainlink.py Executable file
View file

@ -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("/<string:domain>")
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'<body onload="window.location = \'{redirect_url}\'"><p></body>'
if __name__ == "__main__":
app.run()