From aea63696c304fcff8b54212719258387129863b4 Mon Sep 17 00:00:00 2001 From: FullGreaM Date: Mon, 13 Sep 2021 09:07:51 +0300 Subject: [PATCH] up-date structure --- setup.cfg | 4 ++++ setup.py | 8 ++++++++ vk_callback.py => vk_callback/__init__.py | 16 ++++++++-------- .../__pycache__/docs.cpython-36.pyc | Bin .../__pycache__/tools.cpython-36.pyc | Bin .../vk_callback_data}/docs.py | 0 .../vk_callback_data}/tools.py | 0 7 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 setup.cfg create mode 100644 setup.py rename vk_callback.py => vk_callback/__init__.py (86%) rename {vk_callback_data => vk_callback/vk_callback_data}/__pycache__/docs.cpython-36.pyc (100%) rename {vk_callback_data => vk_callback/vk_callback_data}/__pycache__/tools.cpython-36.pyc (100%) rename {vk_callback_data => vk_callback/vk_callback_data}/docs.py (100%) rename {vk_callback_data => vk_callback/vk_callback_data}/tools.py (100%) diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..8bfd5a1 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,4 @@ +[egg_info] +tag_build = +tag_date = 0 + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6eb1c3d --- /dev/null +++ b/setup.py @@ -0,0 +1,8 @@ +from setuptools import setup + +setup(name='vk_callback', + version='1.0', + description='Develop vk callback applications and bots', + packages=['vk_callback'], + author_email='ill2gms@ya.ru', + zip_safe=False) diff --git a/vk_callback.py b/vk_callback/__init__.py similarity index 86% rename from vk_callback.py rename to vk_callback/__init__.py index 1d5d94e..8226cdc 100644 --- a/vk_callback.py +++ b/vk_callback/__init__.py @@ -1,7 +1,7 @@ import flask from flask import Flask, render_template, request, redirect, url_for, flash, make_response, jsonify, send_file, abort -import vk_callback_data.docs -import vk_callback_data.tools +from .vk_callback_data import docs as vk_docs +from .vk_callback_data import tools as vk_tools import traceback @@ -53,13 +53,13 @@ class server: def start(self, print_serverInfo=print, show_documentation=True, default_lang='ru'): global app - if default_lang not in vk_callback_data.docs.docs_info: + if default_lang not in vk_docs.docs_info: default_lang = 'en' flask.print = print_serverInfo if self.port is None: - vk_callback_data.docs.hostname = self.host + vk_docs.hostname = self.host else: - vk_callback_data.docs.hostname = f"http://{self.host}:{self.port}" + vk_docs.hostname = f"http://{self.host}:{self.port}" @app.route('/', methods=['GET', 'POST']) def get_docs_dl(): @@ -74,10 +74,10 @@ class server: if not(show_documentation): return abort(404) - if lang not in vk_callback_data.docs.docs_info: + if lang not in vk_docs.docs_info: return redirect('/documentation/%s' % default_lang) else: - return vk_callback_data.docs.docs_info[lang] + return vk_docs.docs_info[lang] @app.route('/', methods=['GET', 'POST']) def upload_event(group_id): @@ -85,7 +85,7 @@ class server: if int(group_id) in self.group_dict: POST_DATA = request.json # print(POST_DATA) - if 'event_id' in vk_callback_data.tools.repl_to_dict(POST_DATA) and 'secret' in vk_callback_data.tools.repl_to_dict(POST_DATA): + if 'event_id' in vk_tools.repl_to_dict(POST_DATA) and 'secret' in vk_tools.repl_to_dict(POST_DATA): if 'object' in POST_DATA: event_object = vk_event( type=POST_DATA['type'], diff --git a/vk_callback_data/__pycache__/docs.cpython-36.pyc b/vk_callback/vk_callback_data/__pycache__/docs.cpython-36.pyc similarity index 100% rename from vk_callback_data/__pycache__/docs.cpython-36.pyc rename to vk_callback/vk_callback_data/__pycache__/docs.cpython-36.pyc diff --git a/vk_callback_data/__pycache__/tools.cpython-36.pyc b/vk_callback/vk_callback_data/__pycache__/tools.cpython-36.pyc similarity index 100% rename from vk_callback_data/__pycache__/tools.cpython-36.pyc rename to vk_callback/vk_callback_data/__pycache__/tools.cpython-36.pyc diff --git a/vk_callback_data/docs.py b/vk_callback/vk_callback_data/docs.py similarity index 100% rename from vk_callback_data/docs.py rename to vk_callback/vk_callback_data/docs.py diff --git a/vk_callback_data/tools.py b/vk_callback/vk_callback_data/tools.py similarity index 100% rename from vk_callback_data/tools.py rename to vk_callback/vk_callback_data/tools.py