#!/usr/bin/env python
# -*- coding: utf-8 -*-

import webapp2, currency_rates, temperature

class Main(webapp2.RequestHandler):
    def get(self):
        html = """
<!DOCTYPE html>
<html dir="ltr">
    <head>
        <meta charset="utf-8">
        <title>Rate Exchange JSON/JSONP APIs by Hippasus Chu</title>
        <style>
            body { font: 1.2em/1.2 Arial; }
            h1 { font: bold 2em/2 Verdana; }
            p { padding: 10px 20px; font: 1em/1.5 Consolas; color: #bdbdbd; text-align: right; }
        </style>
    </head>
    <body>
        <h1>Rate Exchange JSON/JSONP APIs</h1>
        <ul>
            <li>Currency API: <a href="$host_url/currency?from=USD&to=EUR&q=1" target="_blank" rel="nofollow">$host_url/currency?from=USD&to=EUR&q=1</a></li>
            <li>Temperature API: <a href="$host_url/temperature?mode=C2F&q=37" target="_blank" rel="nofollow">$host_url/temperature?mode=C2F&q=37</a></li>
        </ul>
        <div>
            Got an error? Please help to create issue at <a href="https://github.com/hippasus/ExchangeRates/issues">https://github.com/hippasus/ExchangeRates/issues</a>.
        </div>
        <p>--By Hippasus Chu</p>
    </body>
</html>
        """
        
        html = html.replace('$host_url', self.request.host_url)
        
        self.response.headers['Content-Type'] = 'text/html'
        self.response.out.write(html)

app = webapp2.WSGIApplication([
                               ('/', Main),
                               ('/currency', currency_rates.CurrencyRates),
                               ('/temperature', temperature.Temperature)])

@@ -421,16 +421,23 @@
        p
+.author
  %7B paddi
@@ -508,24 +508,89 @@
 n: right; %7D%0A
+            .got-error %7B font-size: 1em; font-family: Verdana; %7D%0A
         %3C/st
@@ -1016,16 +1016,34 @@
     %3Cdiv
+ class=%22got-error%22
 %3E%0A      
@@ -1048,16 +1048,19 @@
         
+%3Ci%3E
 Got an e
@@ -1064,16 +1064,20 @@
 n error?
+%3C/i%3E
  Please 
@@ -1091,16 +1091,19 @@
  create 
+an 
 issue at
@@ -1240,17 +1240,425 @@
        %3C
-p
+h3%3EHelp needed!%3C/h3%3E%0A        %3Cp%3EWe've reached the %3Ca href=%22https://developers.google.com/appengine/docs/quotas#UrlFetch%22 target=%22_blank%22%3EGAE URL Fetch Quota%3C/a%3E for the currency API.%0A        %3Cbr /%3EAnd I need your help to enable billing to get larger quota. Do please help to click %3Ca href=%22http://ko-fi.com?i=8d071856392d304%22 target=%22_blank%22%3Ethis link%3C/a%3E and donate me $1.00USD.%3C/p%3E%0A        %3Cp class=%22author%22
 %3E--By Hi

add help message in home page.