Finalize for release

This commit is contained in:
syeopite 2021-05-23 06:58:31 -07:00
parent 12206c14c6
commit 45b6f4e5d2
No known key found for this signature in database
GPG Key ID: 6FA616E5A5294A82
3 changed files with 26 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
venv
.idea
__pycache__
*.log

View File

@ -1,4 +1,9 @@
# [WIP] Quic proxy built in Python for the Invidious project.
# Quic proxy built in Python for the Invidious project.
## Installation
1. Clone the repository
2. Create a python virtual environment
3. Install dependencies through pip `pip install -r requirements.txt`
## Usage

23
main.py
View File

@ -1,5 +1,6 @@
import pathlib
import logging
import argparse
import asyncio
import pytomlpp
@ -9,8 +10,6 @@ from aiohttp import web
import quicclient
logging.basicConfig(filename="test.log", level=logging.INFO)
APP_NAME = "QUICProxy"
APP_AUTHOR = "syeopite"
@ -28,6 +27,24 @@ if not config:
routes = web.RouteTableDef()
def process_cli_args():
# Taken from https://stackoverflow.com/a/20663028
parser = argparse.ArgumentParser()
parser.add_argument(
'-d', '--debug',
help="Print lots of debugging statements",
action="store_const", dest="loglevel", const=logging.DEBUG,
default=logging.WARNING,
)
parser.add_argument(
'-v', '--verbose',
help="Be verbose",
action="store_const", dest="loglevel", const=logging.INFO,
)
args = parser.parse_args()
logging.basicConfig(level=args.loglevel)
@routes.post("/")
async def post(request):
arguments = await request.json()
@ -59,6 +76,6 @@ async def main():
request_processor = quicclient.RequestProcessor()
if __name__ == '__main__':
process_cli_args()
web.run_app(main(), port=config.get("port", 7912), host=config.get("host", "0.0.0.0"))