コード例 #1
0
ファイル: api.py プロジェクト: yarygina/MicroBank
def hello():
    return niceJson({"subresource_uris": allLinks(app)}, 200)
コード例 #2
0
ファイル: api.py プロジェクト: yarygina/MicroBank
    try:
        url = TRANSACTIONS_SERVICE_URL + 'transactions/%s' % transNum
        res = requests.delete(url)
    except ConnectionError as e:
        raise ServiceUnavailable("Transactions service connection error: %s." %
                                 e)

    if res.status_code != codes.ok:
        raise NotFound("Cannot cancel transaction %s, resp %s, status code %s" \
                       % (transNum, res.text, res.status_code))
    else:
        return res.json()['number']


# All APIs provided by this application, automatically generated
LOCAL_APIS = allLinks(app)
# All external APIs that this application relies on, manually created
KNOWN_REMOTE_APIS = [
    ACCOUNTS_SERVICE_URL + "accounts",
    TRANSACTIONS_SERVICE_URL + "transactions"
]

# def main():
#     logger.info("%s service starting now: MTLS=%s, Token=%s" \
#                 % (SERVICE_TYPE, MTLS, TOKEN))
#     # Start Flask web server
#     if MTLS and serviceCert:
#         # SSL configuration for Flask. Order matters!
#         cert = serviceCert.getServiceCertFileName()
#         key = serviceCert.getServiceKeyFileName()
#         if cert and key: