Skip to content

Instantly share code, notes, and snippets.

@malteo
Last active December 29, 2015 23:59
Show Gist options
  • Save malteo/7746729 to your computer and use it in GitHub Desktop.
Save malteo/7746729 to your computer and use it in GitHub Desktop.
URLbot
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>URLbot</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
<!-- Custom styles for this template -->
<style>
body {
padding-top: 50px;
}
.centered {
padding: 40px 15px;
text-align: center;
}
</style>
</head>
<body>
<div class="container">
<div class="centered">
<h1>URL raccolti da bottino</h1>
<p class="lead">Ora vado a mangiare.<br> Fate i bravi.</p>
</div>
<div class="row">
<table>
{% for url in urls %}
<tr>
<td><a href="{{ url }}">{{ url }}</a></td>
</tr>
{% endfor %}
</table>
</div>
</div><!-- /.container -->
</body>
</html>
from importd import d
import json
import redis
@d("/")
def index(request):
r = redis.StrictRedis(host='dev.libersoft.it', port=7812)
brain = json.loads(r.get('hubot:storage'))
return "index.html", {'urls': reversed(brain[u'urls'])}
if __name__ == "__main__":
d.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment