Ejemplo n.º 1
0
import parsenvy

try:
    subscription_key = open(".azure_key").read().strip()
except:
    subscription_key = parsenvy.str("AZURE_KEY")

endpoint = "https://api.cognitive.microsofttranslator.com"

location = "westeurope"

if __name__ == '__main__':
    print(endpoint)
Ejemplo n.º 2
0
from flask_sslify import SSLify
import github3
import parsenvy
from raven.contrib.flask import Sentry
from waitress import serve

parser = configparser.SafeConfigParser()
parser.read('defaults.ini')

VERSION = parser.get('APPLICATION', 'version')

USER_NUMBER = parser.get('USER', 'number')
USER_DAY = parser.get('USER', 'day')
USER_TIME = parser.get('USER', 'time')

DEPLOYMENT = parsenvy.str('DEPLOYMENT', 'DEVELOPMENT')
PORT = parsenvy.int('PORT', 5000)

app = Flask(__name__)
app.secret_key = str(random.getrandbits(128))

sentry = Sentry(app)

if DEPLOYMENT == 'PRODUCTION':
    DB_URL = parsenvy.str('DATABASE_URL')

elif DEPLOYMENT == 'DEVELOPMENT':
    current_dir = os.getcwd()
    full_path = os.path.join(current_dir, 'sm.db')
    DB_URL = 'sqlite:///{0}'.format(full_path)
Ejemplo n.º 3
0
 def test_none(self):
     self.assertIsNone(parsenvy.str('STR_NONE'))
Ejemplo n.º 4
0
 def test_default(self):
     self.assertEqual(parsenvy.str('STR_NONE', 'hi'), 'hi')
Ejemplo n.º 5
0
 def test_list(self):
     os.environ['STR_HELLO'] = 'hello'
     self.assertEqual(parsenvy.str('STR_HELLO'), 'hello')
     os.environ['STR_EMPTY'] = ''
     self.assertEqual(parsenvy.str('STR_EMPTY'), '')
Ejemplo n.º 6
0
def test_str_empty(monkeypatch):
    monkeypatch.setenv("foo", "")
    assert parsenvy.str("foo", "bar") == "bar"
Ejemplo n.º 7
0
def test_str_valid(monkeypatch):
    monkeypatch.setenv("foo", "bar")
    assert parsenvy.str("foo") == "bar"
Ejemplo n.º 8
0
import logging
import parsenvy

logger = logging.getLogger(__name__)

# mlflow
# sometimes when saving links in text.. there is a new line .. strip removes that
try:
    TRACKING_URI = open(".mlflow_uri").read().strip()
except:
    TRACKING_URI = parsenvy.str("MLFLOW_URI")
#TRACKING_URI_DEV = "http://127.0.0.1:5000/"

EXPERIMENT_NAME = "nlp-trio"
Ejemplo n.º 9
0
import boto3
import parsenvy

AWS_ACCESS_KEY_ID = parsenvy.str('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = parsenvy.str('AWS_SECRET_ACCESS_KEY')


def send_email(email, subject, text, html):
    b3 = boto3.client('ses',
                      region_name='us-east-1',
                      aws_access_key_id=AWS_ACCESS_KEY_ID,
                      aws_secret_access_key=AWS_SECRET_ACCESS_KEY)

    email_kwargs = {
        'Source': 'Starminder <*****@*****.**>',
        'Destination': {
            'ToAddresses': [email],
        },
        'Message': {
            'Subject': {
                'Data': subject
            },
            'Body': {
                'Text': {
                    'Data': text
                },
                'Html': {
                    'Data': html
                }
            }
        },