Compare commits
64 Commits
b91b68fa4a
...
dev
Author | SHA1 | Date | |
---|---|---|---|
35cce46eed | |||
f5d293c11b | |||
858e18362f | |||
b226256187 | |||
a945a13196 | |||
32648d0f7a | |||
a793a9861b | |||
2e7a0546dd | |||
7a565e0511 | |||
2c5444a245 | |||
9fec4e81cc | |||
6ead97eee0 | |||
2227554977 | |||
c58b6449aa | |||
f643b91a8b | |||
d6b8c528de | |||
2e8bc421c6 | |||
7fbd62659d | |||
d34756d9fc | |||
67d71fa43e | |||
eb03474392 | |||
58d7de6073 | |||
8a79853559 | |||
68a57a8c4e | |||
32fda37113 | |||
f07cd6c441 | |||
b05aec4a3c | |||
02b6d29367 | |||
bb22760426 | |||
5f68e18cff | |||
f39fa6f936 | |||
2c6ab3d96d | |||
ea83ce5f80 | |||
d3a75b5f95 | |||
fa1309b87f | |||
f24a03fde9 | |||
d3aee82cbe | |||
54aa6ef712
|
|||
36d297f227
|
|||
60c6698495 | |||
2376c1355d | |||
93beb10c49 | |||
269c08e5de | |||
19a74de675 | |||
5585574eac | |||
f8feb40723 | |||
0c18cf9bf1 | |||
68e2eaffcb | |||
3c8229238c | |||
0c3161ef03 | |||
244b779107 | |||
b04d0d60d0 | |||
735aba20df | |||
6f3ef28fb5 | |||
c7c7971253 | |||
9c046b63d9 | |||
f192459855 | |||
bb25397fe6
|
|||
97fa82d90e
|
|||
cef93181fd
|
|||
0dbe372777
|
|||
1647fe4ddb
|
|||
ee5b481ac0 | |||
f98f7f8df6
|
2
.coveragerc
Normal file
2
.coveragerc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[run]
|
||||||
|
omit=venv/*
|
93
.drone.yml
93
.drone.yml
@ -3,32 +3,94 @@ type: docker
|
|||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: restore-cache-with-filesystem
|
||||||
|
image: meltwater/drone-cache
|
||||||
|
settings:
|
||||||
|
backend: "filesystem"
|
||||||
|
restore: true
|
||||||
|
cache_key: "{{ .Repo.Name }}"
|
||||||
|
archive_format: "gzip"
|
||||||
|
filesystem_cache_root: "/tmp/cache"
|
||||||
|
mount:
|
||||||
|
- '.pipcache'
|
||||||
|
volumes:
|
||||||
|
- name: cache
|
||||||
|
path: /tmp/cache
|
||||||
|
|
||||||
|
|
||||||
- name: static_analysis
|
- name: static_analysis
|
||||||
image: python:3
|
image: python:3
|
||||||
commands:
|
commands:
|
||||||
- pip3 install pylint bandit mccabe
|
- pip3 install --cache-dir='./.pipcache' pylint bandit mccabe
|
||||||
- pip3 install -r requirements.txt
|
- pip3 install --cache-dir='./.pipcache' -r requirements.txt
|
||||||
- find . -name "*.py" -exec python3 -m py_compile '{}' \;
|
- find . -name "*.py" -exec python3 -m py_compile '{}' \;
|
||||||
- find . -name "*.py" -exec pylint '{}' + || if [ $? -eq 1 ]; then echo "you fail"; fi
|
- find . -name "*.py" -exec pylint '{}' + || if [ $? -eq 1 ]; then echo "you fail"; fi
|
||||||
- find . -name "*.py" -exec python3 -m mccabe --min 3 '{}' + || if [ $? -eq 1 ]; then echo "you fail"; fi
|
- find . -name "*.py" -exec python3 -m mccabe --min 3 '{}' + || if [ $? -eq 1 ]; then echo "you fail"; fi
|
||||||
- bandit -r . + || if [ $? -eq 1 ]; then echo "you fail"; fi
|
- bandit -r . + || if [ $? -eq 1 ]; then echo "you fail"; fi
|
||||||
|
|
||||||
- name: build
|
- name: build-app
|
||||||
|
image: banzaicloud/drone-kaniko
|
||||||
|
settings:
|
||||||
|
registry: registry.kmlabz.com
|
||||||
|
repo: goldenpogacsa/${DRONE_REPO_NAME}
|
||||||
|
username:
|
||||||
|
from_secret: DOCKER_USERNAME
|
||||||
|
password:
|
||||||
|
from_secret: DOCKER_PASSWORD
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
- ${DRONE_BUILD_NUMBER}
|
||||||
|
|
||||||
|
- name: make_docs
|
||||||
|
image: python:3.8
|
||||||
|
commands:
|
||||||
|
- pip3 install --cache-dir='./.pipcache' Sphinx sphinx_rtd_theme
|
||||||
|
- pip3 install -r requirements.txt
|
||||||
|
- cd docs
|
||||||
|
- make html
|
||||||
|
|
||||||
|
- name: rebuild-cache-with-filesystem
|
||||||
|
image: meltwater/drone-cache
|
||||||
|
pull: true
|
||||||
|
settings:
|
||||||
|
backend: "filesystem"
|
||||||
|
rebuild: true
|
||||||
|
cache_key: "{{ .Repo.Name }}"
|
||||||
|
archive_format: "gzip"
|
||||||
|
filesystem_cache_root: "/tmp/cache"
|
||||||
|
mount:
|
||||||
|
- '.pipcache'
|
||||||
|
volumes:
|
||||||
|
- name: cache
|
||||||
|
path: /tmp/cache
|
||||||
|
|
||||||
|
- name: build_docs
|
||||||
image: docker:stable-dind
|
image: docker:stable-dind
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
path: /var/run
|
path: /var/run
|
||||||
environment:
|
environment:
|
||||||
DOCKER_USERNAME:
|
DOCKER_USERNAME:
|
||||||
from_secret: DOCKER_USERNAME
|
from_secret: DOCKER_USERNAME
|
||||||
DOCKER_PASSWORD:
|
DOCKER_PASSWORD:
|
||||||
from_secret: DOCKER_PASSWORD
|
from_secret: DOCKER_PASSWORD
|
||||||
commands:
|
commands:
|
||||||
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
- cd docs
|
||||||
- docker build -t="$DOCKER_USERNAME/consumer" .
|
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin registry.kmlabz.com
|
||||||
- docker build -t="$DOCKER_USERNAME/consumer:$DRONE_BUILD_NUMBER" .
|
- docker build -t="registry.kmlabz.com/goldenpogacsa/consumer-api-docs" .
|
||||||
- docker push "$DOCKER_USERNAME/consumer"
|
- docker build -t="registry.kmlabz.com/goldenpogacsa/consumer-api-docs:$DRONE_BUILD_NUMBER" .
|
||||||
- docker push "$DOCKER_USERNAME/consumer:$DRONE_BUILD_NUMBER"
|
- docker push "registry.kmlabz.com/goldenpogacsa/consumer-api-docs"
|
||||||
|
- docker push "registry.kmlabz.com/goldenpogacsa/consumer-api-docs:$DRONE_BUILD_NUMBER"
|
||||||
|
|
||||||
|
- name: slack
|
||||||
|
image: plugins/slack
|
||||||
|
settings:
|
||||||
|
webhook:
|
||||||
|
from_secret: slack_webhook
|
||||||
|
channel: alerts-ci
|
||||||
|
icon_url: https://cloudcdn.tormakristof.eu/static/drone.svg
|
||||||
|
when:
|
||||||
|
status: [ failure ]
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- name: docker
|
- name: docker
|
||||||
@ -41,3 +103,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
temp: {}
|
temp: {}
|
||||||
|
- name: cache
|
||||||
|
host:
|
||||||
|
path: "/tmp/cache"
|
||||||
|
14
Dockerfile
14
Dockerfile
@ -1,9 +1,13 @@
|
|||||||
FROM python:3
|
FROM python:3.8-slim
|
||||||
|
|
||||||
WORKDIR /app
|
ADD consumer_api requirements.txt /consumer_api/
|
||||||
|
WORKDIR /consumer_api/
|
||||||
|
|
||||||
RUN pip3 install --no-cache-dir -r requirements.txt
|
ENV PIP_NO_CACHE_DIR=true
|
||||||
|
ENV TZ Europe/Budapest
|
||||||
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||||
|
|
||||||
COPY . ./
|
RUN pip3 install -r requirements.txt
|
||||||
|
|
||||||
CMD ["python3" "app.py"]
|
EXPOSE 80
|
||||||
|
CMD ["gunicorn", "-b", "0.0.0.0:80", "app:app"]
|
||||||
|
12
README.rst
Normal file
12
README.rst
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
================
|
||||||
|
P2P Consumer API
|
||||||
|
================
|
||||||
|
|
||||||
|
Repository for the consumer's API
|
||||||
|
|
||||||
|
implemented interfaces / functionalities:
|
||||||
|
|
||||||
|
* consumer
|
||||||
|
* log
|
||||||
|
* sync
|
||||||
|
|
41
consumer_api/app.py
Normal file
41
consumer_api/app.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import sentry_sdk
|
||||||
|
from sentry_sdk.integrations.flask import FlaskIntegration
|
||||||
|
from flask import Flask
|
||||||
|
import os
|
||||||
|
from db import redis_client
|
||||||
|
from views import ConsumersView, LogView, SyncView
|
||||||
|
|
||||||
|
"""
|
||||||
|
Main Flask RESTful API
|
||||||
|
"""
|
||||||
|
|
||||||
|
__author__ = "@tormakris"
|
||||||
|
__copyright__ = "Copyright 2020, GoldenPogácsa Team"
|
||||||
|
__module_name__ = "app"
|
||||||
|
__version__text__ = "1"
|
||||||
|
|
||||||
|
# Setup sentry
|
||||||
|
SENTRY_DSN = os.environ.get("SENTRY_DSN")
|
||||||
|
if SENTRY_DSN:
|
||||||
|
sentry_sdk.init(
|
||||||
|
dsn=SENTRY_DSN,
|
||||||
|
integrations=[FlaskIntegration()],
|
||||||
|
send_default_pii=True,
|
||||||
|
release=os.environ.get('RELEASE_ID', 'test'),
|
||||||
|
environment=os.environ.get('RELEASEMODE', 'dev')
|
||||||
|
)
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
app.config['REDIS_URL'] = os.environ['REDIS_URL']
|
||||||
|
app.config['LOCAL_UUID'] = os.environ['LOCAL_UUID']
|
||||||
|
app.config['CUSTOMER_TIMEOUT'] = int(os.environ.get('CUSTOMER_TIMEOUT', 30))
|
||||||
|
app.config['PRODUCER_TIMEOUT'] = int(os.environ.get('PRODUCER_TIMEOUT', 60))
|
||||||
|
|
||||||
|
redis_client.init_app(app)
|
||||||
|
|
||||||
|
for view in [ConsumersView, LogView, SyncView]:
|
||||||
|
view.register(app, trailing_slash=False)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app.run(debug=True)
|
3
consumer_api/db.py
Normal file
3
consumer_api/db.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from flask_redis import FlaskRedis
|
||||||
|
|
||||||
|
redis_client = FlaskRedis()
|
5
consumer_api/tests/__init__.py
Normal file
5
consumer_api/tests/__init__.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
# Setup environment variables for testing
|
||||||
|
os.environ["LOCAL_UUID"] = "d8b2e5e2-f675-4194-9324-af58e4b70c54"
|
||||||
|
os.environ["REDIS_URL"] = "redis://192.168.111.121/0"
|
22
consumer_api/tests/consumers_view_test.py
Normal file
22
consumer_api/tests/consumers_view_test.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import db
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def client(mocker):
|
||||||
|
mocker.patch("db.redis_client")
|
||||||
|
db.redis_client.get.side_effect=lambda a: None
|
||||||
|
|
||||||
|
from app import app
|
||||||
|
|
||||||
|
app.config['TESTING'] = True
|
||||||
|
|
||||||
|
with app.test_client() as client:
|
||||||
|
yield client
|
||||||
|
|
||||||
|
|
||||||
|
def test_response_length(client):
|
||||||
|
r = client.get('/consumers')
|
||||||
|
|
||||||
|
assert r.status_code == 200
|
30
consumer_api/tests/log_view_test.py
Normal file
30
consumer_api/tests/log_view_test.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import db
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def client(mocker):
|
||||||
|
mocker.patch("db.redis_client")
|
||||||
|
db.redis_client.get.side_effect=lambda a: None
|
||||||
|
|
||||||
|
from app import app
|
||||||
|
|
||||||
|
app.config['TESTING'] = True
|
||||||
|
|
||||||
|
with app.test_client() as client:
|
||||||
|
yield client
|
||||||
|
|
||||||
|
|
||||||
|
def test_log_code_get(client):
|
||||||
|
r = client.get('/log')
|
||||||
|
|
||||||
|
assert r.status_code == 405
|
||||||
|
|
||||||
|
|
||||||
|
def test_log_code_post(client):
|
||||||
|
data = {
|
||||||
|
"uuid": "asdasdasd",
|
||||||
|
"message": "Hello There!"
|
||||||
|
}
|
||||||
|
r = client.post('/log', json=data)
|
||||||
|
|
||||||
|
assert r.status_code == 204
|
30
consumer_api/tests/sync_view_test.py
Normal file
30
consumer_api/tests/sync_view_test.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import db
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def client(mocker):
|
||||||
|
mocker.patch("db.redis_client")
|
||||||
|
db.redis_client.get.side_effect=lambda a: None
|
||||||
|
|
||||||
|
from app import app
|
||||||
|
|
||||||
|
app.config['TESTING'] = True
|
||||||
|
|
||||||
|
with app.test_client() as client:
|
||||||
|
yield client
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def test_log_code_get(client):
|
||||||
|
r = client.get('/sync')
|
||||||
|
|
||||||
|
assert r.status_code == 405
|
||||||
|
|
||||||
|
|
||||||
|
def test_log_code_post(client):
|
||||||
|
data = {
|
||||||
|
"uuid": "tesuuid"
|
||||||
|
}
|
||||||
|
r = client.post('/sync', json=data)
|
||||||
|
|
||||||
|
assert r.status_code == 200
|
3
consumer_api/views/__init__.py
Normal file
3
consumer_api/views/__init__.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from .consumers_view import ConsumersView
|
||||||
|
from .log_view import LogView
|
||||||
|
from .sync_view import SyncView
|
19
consumer_api/views/consumers_view.py
Normal file
19
consumer_api/views/consumers_view.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
from db import redis_client
|
||||||
|
from flask import jsonify
|
||||||
|
from flask_classful import FlaskView
|
||||||
|
|
||||||
|
|
||||||
|
class ConsumersView(FlaskView):
|
||||||
|
|
||||||
|
def get(self):
|
||||||
|
keys = redis_client.keys('consumer_*')
|
||||||
|
|
||||||
|
list_of_customer_ips = []
|
||||||
|
|
||||||
|
for key in keys:
|
||||||
|
info = json.loads((redis_client.get(key) or b"{}").decode('utf-8'))
|
||||||
|
list_of_customer_ips.append(info['ip'])
|
||||||
|
|
||||||
|
return jsonify(list_of_customer_ips)
|
34
consumer_api/views/log_view.py
Normal file
34
consumer_api/views/log_view.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
from flask import request, current_app, Response
|
||||||
|
from flask_classful import FlaskView
|
||||||
|
from db import redis_client
|
||||||
|
|
||||||
|
|
||||||
|
class LogView(FlaskView):
|
||||||
|
|
||||||
|
def post(self):
|
||||||
|
# Record the IP address of the producer
|
||||||
|
remote_uuid = request.json['uuid']
|
||||||
|
remote_ip = request.remote_addr
|
||||||
|
|
||||||
|
prod_key = f"producer_{remote_uuid}"
|
||||||
|
|
||||||
|
last_known_remote_ip = redis_client.get(prod_key)
|
||||||
|
if last_known_remote_ip:
|
||||||
|
last_known_remote_ip = last_known_remote_ip.decode('utf-8')
|
||||||
|
|
||||||
|
if not last_known_remote_ip:
|
||||||
|
current_app.logger.info(f"New producer {remote_uuid} at {remote_ip}")
|
||||||
|
elif last_known_remote_ip != remote_ip:
|
||||||
|
current_app.logger.info(
|
||||||
|
f"IP address of producer {remote_uuid} have changed: {last_known_remote_ip} -> {remote_ip}")
|
||||||
|
|
||||||
|
# update expirity
|
||||||
|
redis_client.set(prod_key, remote_ip.encode('utf-8'))
|
||||||
|
redis_client.expire(prod_key, current_app.config["PRODUCER_TIMEOUT"])
|
||||||
|
|
||||||
|
# print out message
|
||||||
|
current_app.logger.info(f"New message: {request.json['message']}")
|
||||||
|
|
||||||
|
# return HTTP 204 - No content message
|
||||||
|
return Response(status = 204)
|
||||||
|
|
46
consumer_api/views/sync_view.py
Normal file
46
consumer_api/views/sync_view.py
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import json
|
||||||
|
import time
|
||||||
|
from flask import request, current_app, jsonify
|
||||||
|
from flask_classful import FlaskView
|
||||||
|
from db import redis_client
|
||||||
|
|
||||||
|
|
||||||
|
class SyncView(FlaskView):
|
||||||
|
|
||||||
|
def post(self):
|
||||||
|
remote_uuid = request.json['uuid']
|
||||||
|
|
||||||
|
if 'ip' in request.json:
|
||||||
|
remote_ip = request.json['ip']
|
||||||
|
|
||||||
|
if request.remote_addr != remote_ip:
|
||||||
|
current_app.logger.debug(f"IP was overriden by the remote consumer {remote_ip} instead of {request.remote_addr}")
|
||||||
|
|
||||||
|
else:
|
||||||
|
remote_ip = request.remote_addr
|
||||||
|
|
||||||
|
cust_key = f"consumer_{remote_uuid}"
|
||||||
|
|
||||||
|
last_known_info = json.loads((redis_client.get(cust_key) or b"{}").decode('utf-8'))
|
||||||
|
|
||||||
|
if not last_known_info:
|
||||||
|
current_app.logger.info(f"New consumer registered (unknown UUID): {remote_uuid} at {remote_ip}")
|
||||||
|
|
||||||
|
else:
|
||||||
|
if last_known_info['ip'] != remote_ip:
|
||||||
|
current_app.logger.info(f"Address of consumer {remote_uuid} changed to {remote_ip}")
|
||||||
|
|
||||||
|
info = {
|
||||||
|
"uuid": remote_uuid,
|
||||||
|
"ip": remote_ip,
|
||||||
|
"last_seen": time.time()
|
||||||
|
}
|
||||||
|
|
||||||
|
redis_client.set(cust_key, json.dumps(info).encode('utf-8'))
|
||||||
|
redis_client.expire(cust_key, current_app.config["CUSTOMER_TIMEOUT"])
|
||||||
|
|
||||||
|
# return with the current UUID
|
||||||
|
response = {
|
||||||
|
"uuid": current_app.config['LOCAL_UUID']
|
||||||
|
}
|
||||||
|
return jsonify(response)
|
3
docs/Dockerfile
Normal file
3
docs/Dockerfile
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
FROM nginx:latest
|
||||||
|
|
||||||
|
COPY _build/html/ /usr/share/nginx/html
|
20
docs/Makefile
Normal file
20
docs/Makefile
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Minimal makefile for Sphinx documentation
|
||||||
|
#
|
||||||
|
|
||||||
|
# You can set these variables from the command line, and also
|
||||||
|
# from the environment for the first two.
|
||||||
|
SPHINXOPTS ?=
|
||||||
|
SPHINXBUILD ?= sphinx-build
|
||||||
|
SOURCEDIR = .
|
||||||
|
BUILDDIR = _build
|
||||||
|
|
||||||
|
# Put it first so that "make" without argument is like "make help".
|
||||||
|
help:
|
||||||
|
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||||
|
|
||||||
|
.PHONY: help Makefile
|
||||||
|
|
||||||
|
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||||
|
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||||
|
%: Makefile
|
||||||
|
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
55
docs/conf.py
Normal file
55
docs/conf.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# Configuration file for the Sphinx documentation builder.
|
||||||
|
#
|
||||||
|
# This file only contains a selection of the most common options. For a full
|
||||||
|
# list see the documentation:
|
||||||
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html
|
||||||
|
|
||||||
|
# -- Path setup --------------------------------------------------------------
|
||||||
|
|
||||||
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
|
#
|
||||||
|
# import os
|
||||||
|
# import sys
|
||||||
|
# sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
|
|
||||||
|
# -- Project information -----------------------------------------------------
|
||||||
|
|
||||||
|
project = 'Consumer API'
|
||||||
|
copyright = '2020, GoldenPogacsa Inc.'
|
||||||
|
author = 'GoldenPogacsa Inc.'
|
||||||
|
|
||||||
|
# The full version, including alpha/beta/rc tags
|
||||||
|
release = '0.1.0'
|
||||||
|
|
||||||
|
|
||||||
|
# -- General configuration ---------------------------------------------------
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
|
# ones.
|
||||||
|
extensions = [
|
||||||
|
]
|
||||||
|
|
||||||
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
templates_path = []
|
||||||
|
|
||||||
|
# List of patterns, relative to source directory, that match files and
|
||||||
|
# directories to ignore when looking for source files.
|
||||||
|
# This pattern also affects html_static_path and html_extra_path.
|
||||||
|
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for HTML output -------------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
|
# a list of builtin themes.
|
||||||
|
#
|
||||||
|
html_theme = 'sphinx_rtd_theme'
|
||||||
|
|
||||||
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
|
html_static_path = []
|
23
docs/index.rst
Normal file
23
docs/index.rst
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
.. Consumer API documentation master file, created by
|
||||||
|
sphinx-quickstart on Wed Apr 8 21:31:18 2020.
|
||||||
|
You can adapt this file completely to your liking, but it should at least
|
||||||
|
contain the root `toctree` directive.
|
||||||
|
|
||||||
|
Welcome to Consumer API's documentation!
|
||||||
|
========================================
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
:caption: Contents:
|
||||||
|
|
||||||
|
readme
|
||||||
|
source/modules
|
||||||
|
|
||||||
|
|
||||||
|
Indices and tables
|
||||||
|
==================
|
||||||
|
|
||||||
|
* :ref:`genindex`
|
||||||
|
* :ref:`modindex`
|
||||||
|
* :ref:`search`
|
||||||
|
* `Git repository <https://git.kmlabz.com/GoldenPogacsa/consumer-api>`_
|
35
docs/make.bat
Normal file
35
docs/make.bat
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
|
||||||
|
pushd %~dp0
|
||||||
|
|
||||||
|
REM Command file for Sphinx documentation
|
||||||
|
|
||||||
|
if "%SPHINXBUILD%" == "" (
|
||||||
|
set SPHINXBUILD=sphinx-build
|
||||||
|
)
|
||||||
|
set SOURCEDIR=.
|
||||||
|
set BUILDDIR=_build
|
||||||
|
|
||||||
|
if "%1" == "" goto help
|
||||||
|
|
||||||
|
%SPHINXBUILD% >NUL 2>NUL
|
||||||
|
if errorlevel 9009 (
|
||||||
|
echo.
|
||||||
|
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||||
|
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||||
|
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||||
|
echo.may add the Sphinx directory to PATH.
|
||||||
|
echo.
|
||||||
|
echo.If you don't have Sphinx installed, grab it from
|
||||||
|
echo.http://sphinx-doc.org/
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:help
|
||||||
|
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
|
||||||
|
|
||||||
|
:end
|
||||||
|
popd
|
1
docs/readme.rst
Normal file
1
docs/readme.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
.. include:: ../README.rst
|
7
docs/source/app.rst
Normal file
7
docs/source/app.rst
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
app module
|
||||||
|
==========
|
||||||
|
|
||||||
|
.. automodule:: app
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
7
docs/source/db.rst
Normal file
7
docs/source/db.rst
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
db module
|
||||||
|
=========
|
||||||
|
|
||||||
|
.. automodule:: db
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
9
docs/source/modules.rst
Normal file
9
docs/source/modules.rst
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
consumer_api
|
||||||
|
============
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 4
|
||||||
|
|
||||||
|
app
|
||||||
|
db
|
||||||
|
views
|
38
docs/source/views.rst
Normal file
38
docs/source/views.rst
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
views package
|
||||||
|
=============
|
||||||
|
|
||||||
|
Submodules
|
||||||
|
----------
|
||||||
|
|
||||||
|
views.consumers\_view module
|
||||||
|
----------------------------
|
||||||
|
|
||||||
|
.. automodule:: views.consumers_view
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
views.log\_view module
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
.. automodule:: views.log_view
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
views.sync\_view module
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
.. automodule:: views.sync_view
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
|
|
||||||
|
Module contents
|
||||||
|
---------------
|
||||||
|
|
||||||
|
.. automodule:: views
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
@ -1 +1,5 @@
|
|||||||
sentry_sdk
|
sentry_sdk
|
||||||
|
flask
|
||||||
|
flask-redis
|
||||||
|
flask-classful
|
||||||
|
gunicorn
|
4
requirements_dev.txt
Normal file
4
requirements_dev.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
pytest
|
||||||
|
pytest-mock
|
||||||
|
mock
|
||||||
|
coverage
|
Reference in New Issue
Block a user