项目作者: epomatti

项目描述 :
Python API using Flask to integrate with Azure Storage and Azure Service Bus
高级语言: Python
项目地址: git://github.com/epomatti/python-api.git
创建时间: 2019-09-23T13:25:13Z
项目社区:https://github.com/epomatti/python-api

开源协议:

下载


Python API - Service Bus, Blob Storage

A sample Python API using Flask to integrate with Azure Storage and Azure Service Bus.

Infrastructure

You’ll need a storage account with a blob container, and a Service Bus with a queue.

  1. group='rg-myproj'
  2. location='eastus2'
  3. storage='stmyproj'
  4. namespace='bus-myproj'
  5. az group create -n $group -l $location
  6. az storage account create -n $storage -g $group -l $location
  7. az storage container create -n 'files' --account-name $storage
  8. az servicebus namespace create -n $namespace -g $group -l $location
  9. az servicebus queue create -n 'inQueue' --namespace-name $namespace -g $group
  10. az servicebus queue create -n 'outQueue' --namespace-name $namespace -g $group

Running it

Install dependencies:

  1. python3 -m venv env
  2. . env/bin/activate
  3. pip install -r requirements.txt

Create the configurations file and temp directory:

  1. mkdir files
  2. cp example.config.ini config.ini

Generate the data and serve the application:

  1. # Generate the sample data
  2. python3 src/data_generator.py
  3. # Run the program
  4. python3 src/main.py

With Docker:

  1. docker build -t python-api .
  2. docker run -it --rm --name python-api python-api