import types from bottle import get, route, run, static_file, template, redirect, request, TEMPLATE_PATH, jinja2_template as template from bs4 import BeautifulSoup baseURLs = [ "http://www.sumidacity-gym.com/", "https://www.koto-hsc.or.jp/sports_center3/" ] extension = ".pdf" keywords = ["個人利用", "体育館", "体育室"] urls = [ "http://www.sumidacity-gym.com/guide/kojin/", "https://www.koto-hsc.or.jp/sports_center3/schedule/", ] TEMPLATE_PATH.extend(['./views', './css', './images', './js']) notFound = "notFound.html" # htmlテンプレートに渡すリンク先URLを取得 @route('/') def get_link(): output = [] global downloadURLs downloadURLs = [] # リンク取得先のWebサイトにリクエストを送信し、PDFのリンクURLを取得する for url in urls: r = requests.get(url)
import os from pymongo import MongoClient from bottle import route, run, template, static_file, TEMPLATE_PATH # add template folders to bottlepy path TEMPLATE_PATH.extend(('./templates/', './templates/blocks/')) # detect if on heroku on_heroku = 'DYNO' in os.environ # connect with mongo (heroku) if (on_heroku): client = MongoClient( host="mongodb://*****:*****@ds043942.mongolab.com:43942/heroku_646gdt3n") db = client.heroku_646gdt3n else: client = MongoClient() db = client.dba # get collections medicos = db.Medico doentes = db.Doente # static files @route('/static/:path#.+#', name='static') def index(path): return static_file(path, root='static')
import os from pymongo import MongoClient from bottle import route, run, template, static_file, TEMPLATE_PATH # add template folders to bottlepy path TEMPLATE_PATH.extend(('./templates/', './templates/blocks/')) # detect if on heroku on_heroku = 'DYNO' in os.environ # connect with mongo (heroku) if (on_heroku): client = MongoClient( host= "mongodb://*****:*****@ds043942.mongolab.com:43942/heroku_646gdt3n" ) db = client.heroku_646gdt3n else: client = MongoClient() db = client.dba # get collections medicos = db.Medico doentes = db.Doente # static files @route('/static/:path#.+#', name='static') def index(path): return static_file(path, root='static')