-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathddns.py
executable file
·32 lines (26 loc) · 1.02 KB
/
ddns.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#-----------------------------------------------------------------------------
# /ddnscode
#
# OK. We are being lazy here. We are leveraging this web site as a landing page for
# displaying the code for the Dynamic DNS Demonstration application
#
from bottle import Bottle, run, route, template, request, response, abort, static_file, default_app, redirect
import config
@route('/ddnscode', method='GET')
def ddnscode():
# This only works for the ddns wesbsite over the supported protocol
if request.headers['Host'] != config.dynamicdns_website or request.urlparts.scheme != config.protocol:
return abort(404)
# Get the data from the URL
code = request.query.get('code')
error = request.query.get('error')
if error != None and error != '':
return template('ddns_error',
{
'error': error
})
# Return template
return template('ddns_oauth_code.tpl',
{
"oauth_code" : code
})