Skip to content

Python library for Flask framework to connect microservices with Control Tower API Gateway

License

Notifications You must be signed in to change notification settings

Skydipper/ct-register-microservice-python-flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# Microservice Registration for Python Flask applications

Build Status Test Coverage

Usage

How to register a microservice to CT

import CTRegisterMicroserviceFlask

info = load_config_json('register')
swagger = load_config_json('swagger')
CTRegisterMicroserviceFlask.register(
    app = application,
    name = '<microservice_name>',
    info = info,
    swagger = swagger,
    mode = CTRegisterMicroserviceFlask.AUTOREGISTER_MODE if os.getenv('ENVIRONMENT') == 'dev' else CTRegisterMicroserviceFlask.NORMAL_MODE,
    ct_url = os.getenv('CT_URL'),
    url = os.getenv('LOCAL_URL')
)

How to do a request to another microservice

import CTRegisterMicroserviceFlask

config = {
    'uri': '/dataset/d02df2f6-d80c-4274-bb6f-f062061655c4',
    'method': 'GET',
}
response = CTRegisterMicroserviceFlask.request_to_microservice(config)

Tests

Before you run the tests, be sure to install the necessary development libraries, using pip install .[dev].

Actual test execution is done by running the pytest executable on the root of the project.

About

Python library for Flask framework to connect microservices with Control Tower API Gateway

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages