Beispiel #1
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__= 'Frederic Laurent'
__version__= '1.0'
__license__ = "LGPL"
__email__ = "*****@*****.**"


from bottle import route, run, request, response, error

#https://github.com/martinblech/mimerender
import mimerender
mimerender = mimerender.BottleMimeRender()

# My little data
mydata={ "0836221362" : { "title":"The Days Are Just Packed", 
				"author":"Bill Watterson", 
				"img":"http://isbn.abebooks.com/mz/57/83/0836217357.jpg"}
	}

def html_repr(data):
	"""
	HTML Representation of my data
	data : my data in a dictionary
	"""
	html="""
	<html>
		<head><title>Book ISBN %s</title></head>
		<body><h1>%s</h1>
		 <h2>%s</h2><img src="%s"/>
		</body>
Beispiel #2
0
from elasticsearch.exceptions import NotFoundError
import yaml
import sys
import json
from rdflib import Graph, plugin
import mimerender
import cgi
import html
import re
from json import dumps

mimerender.register_mime("turtle", ("text/turtle","text/n3"))
mimerender.register_mime("rdfxml", ("application/rdf+xml", "application/xml"))
mimerender.register_mime("nt", ("application/n-triples",))
#mimerender.register_mime("jsonld", ("application/ld+json",))
produces = mimerender.BottleMimeRender()

conf = {}

def find_static():
    cwd = None
    try:
        cwd = os.path.dirname(__file__)
    except NameError:
        cwd = "."
    return os.path.abspath(os.path.join(cwd, "static"))

static_root = find_static()


es=None