refactor, tweak html layout
This commit is contained in:
@@ -15,6 +15,11 @@
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
label {
|
||||
font-weight: bold;
|
||||
font-family: sans, sans-serif;
|
||||
}
|
||||
|
||||
#output { flex: 99 1 auto; }
|
||||
</style>
|
||||
|
||||
@@ -47,11 +52,13 @@
|
||||
</head>
|
||||
<body>
|
||||
<div class="flex">
|
||||
<label for="item">Item:</label>
|
||||
<input id="item" type="text" size="20" />
|
||||
<br />
|
||||
<button id="search">Find Quests and Monsters</button>
|
||||
<br />
|
||||
<textarea readonly="true" rows="10" cols="80" id="output"></textarea>
|
||||
<div>
|
||||
<label for="item">Item:</label>
|
||||
<input id="item" type="text" size="20" />
|
||||
<button id="search">Find quests!</button>
|
||||
<a href="http://www.reddit.com/r/MonsterHunter/comments/2z4pz3/finding_the_best_quest_to_farm_an_item_python/">(output explanation)</a>
|
||||
</div>
|
||||
<br />
|
||||
<textarea readonly="true" rows="10" cols="80" id="output"></textarea>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from flup.server.fcgi import WSGIServer
|
||||
|
||||
import reward_webapp
|
||||
from mhapi_wsgi import application
|
||||
|
||||
if __name__ == '__main__':
|
||||
WSGIServer(reward_webapp.application).run()
|
||||
WSGIServer(application).run()
|
||||
@@ -12,6 +12,9 @@ import mhrewards
|
||||
DB_VERSION = "20150313"
|
||||
PREFIX = "/mhapi/"
|
||||
|
||||
# good for testing, use 1 hour = 3600 for deployment
|
||||
MAX_AGE = "60"
|
||||
|
||||
logging.basicConfig(filename="/tmp/reward_webapp.log", level=logging.INFO)
|
||||
|
||||
|
||||
@@ -62,12 +65,12 @@ class App(object):
|
||||
|
||||
def find_item_rewards(self, req, resp):
|
||||
version = "1"
|
||||
resp.cache_control = "max-age=60"
|
||||
resp.etag = DB_VERSION + version
|
||||
etag = DB_VERSION + version
|
||||
resp.cache_control = "public, max-age=" + MAX_AGE
|
||||
resp.etag = etag
|
||||
|
||||
self.log.info("etag = %s", resp.etag)
|
||||
if req.if_match == resp.etag:
|
||||
return HTTPNotModified()
|
||||
if etag in req.if_none_match:
|
||||
return exc.HTTPNotModified()
|
||||
|
||||
resp.content_type = "text/plan"
|
||||
|
||||
@@ -83,12 +86,12 @@ class App(object):
|
||||
|
||||
def get_all_names(self, req, resp):
|
||||
version = "2"
|
||||
resp.cache_control = "max-age=60"
|
||||
resp.etag = DB_VERSION + version
|
||||
etag = DB_VERSION + version
|
||||
resp.cache_control = "public, max-age=" + MAX_AGE
|
||||
resp.etag = etag
|
||||
|
||||
self.log.info("get all names etag = %s", resp.etag)
|
||||
if req.if_match == resp.etag:
|
||||
return HTTPNotModified()
|
||||
if etag in req.if_none_match:
|
||||
return exc.HTTPNotModified()
|
||||
|
||||
resp.content_type = "application/json"
|
||||
resp.body_file.write("[")
|
||||
@@ -111,7 +114,7 @@ application = App()
|
||||
|
||||
if __name__ == '__main__':
|
||||
from wsgiref.simple_server import make_server
|
||||
httpd = make_server("localhost", 8080, application)
|
||||
httpd = make_server("", 8080, application)
|
||||
try:
|
||||
httpd.serve_forever()
|
||||
except KeyboardInterrupt:
|
||||
Reference in New Issue
Block a user