This repository has been archived by the owner on Mar 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
75 lines (59 loc) · 2.19 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""
config
~~~~~~
Provides app configuration settings
"""
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals)
from os import path as p
BASEDIR = p.dirname(__file__)
PARENTDIR = p.dirname(BASEDIR)
DB_NAME = 'scraperwiki.sqlite'
RECIPIENT = '[email protected]'
class Config(object):
base = 'http://www.geog.ox.ac.uk'
BASE_URL = '%s/research/climate/projects/undp-cp/UNDP_data' % base
FILE_EXT = 'ts.obs.precip.ts.ensemblemean.abs.txt'
DIR = 'Observed/Mean/Timeseries/Absolute'
loc = [
'Afghanistan', 'Angola', 'Antigua and Barbuda', 'Argentina', 'Armenia',
'Bangladesh', 'Barbados', 'Belize', 'Benin', 'Cambodia', 'Cameroon',
'Cape Verde', 'Chad', 'Chile', 'China', 'Colombia', 'Comoros', 'Cuba',
'Dominica', 'Dominican Republic', 'Equatorial Guinea', 'Eritrea',
'Ethiopia', 'Gabon', 'Gambia', 'Ghana', 'Grenada', 'Guinea', 'Guyana',
'Indonesia', 'Jamaica', 'Kenya', 'Liberia', 'Malawi', 'Mali',
'Mauritania', 'Mauritius', 'Mexico', 'Morocco', 'Mozambique', 'Nepal',
'Nicaragua', 'Pakistan', 'Sao Tome and Principe', 'Senegal',
'Sierra Leone', 'St Kitts and Nevis', 'St Lucia',
'St Vincent and the Grenadines', 'Suriname', 'Tanzania', 'The Bahamas',
'Togo', 'Trinidad and Tobago', 'Uganda', 'Vietnam', 'Yemen', 'Zambia']
TABLES = [{'name': 'climate', 'location': l, 'rid': 'rid'} for l in loc]
SQLALCHEMY_DATABASE_URI = 'sqlite:///%s' % p.join(BASEDIR, DB_NAME)
API_LIMIT = 1000
SW = False
DEBUG = False
TESTING = False
PROD = False
CHUNK_SIZE = 2 ** 14
ROW_LIMIT = None
LOGFILE = p.join(BASEDIR, 'http', 'log.txt')
class Scraper(Config):
PROD = True
SW = True
SQLALCHEMY_DATABASE_URI = 'sqlite:///%s' % p.join(PARENTDIR, DB_NAME)
LOGFILE = p.join(PARENTDIR, 'http', 'log.txt')
class Production(Config):
PROD = True
class Development(Config):
DEBUG = True
CHUNK_SIZE = 2 ** 4
ROW_LIMIT = 16
class Test(Config):
SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:'
DEBUG = True
CHUNK_SIZE = 2 ** 4
ROW_LIMIT = 10
TESTING = True