Skip to content

Commit

Permalink
Merge 1aed383 into a999a33
Browse files Browse the repository at this point in the history
  • Loading branch information
lockefox committed Jun 11, 2018
2 parents a999a33 + 1aed383 commit 0dd7152
Show file tree
Hide file tree
Showing 19 changed files with 366 additions and 794 deletions.
9 changes: 9 additions & 0 deletions .coveragerc
@@ -0,0 +1,9 @@
[report]
omit =
publicAPI/__init__.py
publicAPI/_version.py
publicAPI/config.py
publicAPI/exceptions.py

[paths]
source = publicAPI
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -14,7 +14,7 @@ script:
branches:
only:
- master
- travis_test
- v1.2_withsplit
after_success:
- "pip install python-coveralls"
- "coveralls"
13 changes: 13 additions & 0 deletions debian/changelog
@@ -1,3 +1,16 @@
prosper-api (1.3.0) stable; urgency=low

* Fixes serious test errors
* Updates requirements from static to latest
* Upgrades pystan to 2.15.0
* Upgrades fbprophet to 0.3.post1
* Deprecates CREST functionality
* Improves logging patterns
* Improves coverage patterns
* Updates helper scripts

-- John Purcell <jpurcell.ee@gmail.com> Mon, 11 Jun 2018 10:00:00 -0700

prosper-api (1.2.2) stable; urgency=low

* upgrading project for ProsperCommon v1.1.0
Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Expand Up @@ -4,7 +4,7 @@

ifneq ($(wildcard /opt/intel/intelpython3/.*),) #use intelpython bindings if available
override_dh_virtualenv:
dh_virtualenv --python /opt/intel/intelpython3/bin/python3.5 --preinstall cython==0.24 --preinstall numpy==1.11.1 --preinstall matplotlib --use-system-packages
dh_virtualenv --python /opt/intel/intelpython3/bin/python3.5 --preinstall cython --preinstall numpy --preinstall matplotlib --use-system-packages
else
override_dh_virtualenv:
dh_virtualenv --python /usr/bin/python3.5 --preinstall cython --preinstall numpy --preinstall matplotlib
Expand Down
55 changes: 28 additions & 27 deletions publicAPI/__init__.py
@@ -1,24 +1,14 @@
"""__init__.py: Flask app configuration"""
from os import path
import warnings

try:
from flask import Flask

import publicAPI.crest_endpoint as crest_endpoint
import publicAPI.config as config
import publicAPI.split_utils as split_utils

import prosper.common.prosper_logging as p_logging
except ImportError:
warnings.warn('pre-install mode -- requirements not installed', UserWarning)
import logging

HERE = path.abspath(path.dirname(__file__))

def create_app(
settings=None,
local_configs=None,
testmode=False
testmode=False,
):
"""create Flask application (ROOT)
Expand All @@ -27,32 +17,43 @@ def create_app(
Args:
settings (:obj:`dict`, optional): collection of Flask options
local_configs (:obj:`configparser.ConfigParser` optional): app private configs
log_builder (:obj:`prosper_config.ProsperLogger`, optional): logging container
testmode (bool): pytest hook
"""
from flask import Flask

import publicAPI.crest_endpoint as crest_endpoint
import publicAPI.config as config
import publicAPI.split_utils as split_utils

import prosper.common.prosper_logging as p_logging

app = Flask(__name__)

if settings:
app.config.update(settings)

crest_endpoint.API.init_app(app)
crest_endpoint.APP_HACK = app
if not testmode:
log_builder = p_logging.ProsperLogger(
'publicAPI',
local_configs.get_option('LOGGING', 'log_path'),
local_configs
)
if app.debug or testmode:
log_builder.configure_debug_logger()
else:
log_builder.configure_discord_logger()

if log_builder:
for handle in log_builder:
app.logger.addHandler(handle)

config.LOGGER = log_builder.get_logger()

log_builder = p_logging.ProsperLogger(
'publicAPI',
'/var/log/prosper/',
local_configs
)
if app.debug or testmode:
log_builder.configure_debug_logger()
else:
log_builder.configure_discord_logger()

if log_builder:
for handle in log_builder:
app.logger.addHandler(handle)

config.LOGGER = log_builder.get_logger()
config.LOGGER = logging.getLogger('publicAPI')

config.CONFIG = local_configs
config.load_globals(local_configs)
Expand Down
7 changes: 4 additions & 3 deletions publicAPI/api_utils.py
@@ -1,13 +1,14 @@
from os import path, makedirs
from datetime import datetime
import logging

import ujson as json
from tinymongo import TinyMongoClient

import prosper.common.prosper_logging as p_logging
import publicAPI.exceptions as exceptions

LOGGER = p_logging.DEFAULT_LOGGER
LOGGER = logging.getLogger('publicAPI')
HERE = path.abspath(path.dirname(__file__))

CACHE_PATH = path.join(HERE, 'cache')
Expand All @@ -16,7 +17,7 @@
def check_key(
api_key,
throw_on_fail=False,
logger=LOGGER
logger=logging.getLogger('publicAPI')
):
"""check if API key is valid
Expand All @@ -28,7 +29,7 @@ def check_key(
logger (:obj:`logging.logger`): logging handle
Returns:
(bool) access allowed or not
bool: access allowed or not
"""

Expand Down
3 changes: 2 additions & 1 deletion publicAPI/config.py
@@ -1,13 +1,14 @@
"""config.py: a place to hold config/globals"""
from os import path
from enum import Enum
import logging

import prosper.common.prosper_logging as p_logging
import prosper.common.prosper_config as p_config

HERE = path.abspath(path.dirname(__file__))

LOGGER = p_logging.DEFAULT_LOGGER
LOGGER =logging.getLogger('publicAPI')
CONFIG = None #TODO

USER_AGENT = 'lockefox https://github.com/EVEprosper/ProsperAPI'
Expand Down

0 comments on commit 0dd7152

Please sign in to comment.