Alexandre Teles 3b418197c2
feat: implements cdn mirrors endpoints, fix docs, move endpoints to custom routers (#18)
* feat: resolves #5, resolves #4 (#7)

* Implements client generation and management

* fix announcements endpoints

* change annoucements model

* bump deps

* sync with main

* refactor: adopt some functional standards in Releases.py

* feat: add new workflows

* chore: remove unused files

* refactor: update build badge

* refactor: move files around and delete unused ones

* feat: add authentication endpoints

* refactor: clean up code on Clients.py controller

* fix: fix the client secret update endpoint

* refactor: clean up authentication code

* feat: add authentication to client endpoints

* chore: bump deps

* feat: add admin user generation

* feature: add /changelogs endpoint (#10)

* feat: move endpoints into custom routers, resolves #12 (#14)

* refactor: import routers from old branch

* refactor: import InternalCache removal

* refactor: move routes into dedicated routers

* fix: fixes entrypoint

* refactor: add documentation and bump libs

* docs: update description (#16)

* feat: implement cdn mirrors endpoints, closes #15 (#17)

* feat: add cdn mirror endpoints

* refactor: change API version in docs

* docs: fix titles on API docs page

Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2022-10-13 01:48:07 -03:00

32 lines
920 B
Python

import os
import httpx_cache
import app.utils.Logger as Logger
class HTTPXClient:
"""Implements the methods required to get the latest releases and patches from revanced repositories."""
@staticmethod
def create() -> httpx_cache.AsyncClient:
"""Create HTTPX client with cache
Returns:
httpx_cache.AsyncClient: HTTPX client with cache
"""
headers = {'Accept': "application/vnd.github+json",
'Authorization': "token " + os.environ['GITHUB_TOKEN']
}
httpx_logger = Logger.HTTPXLogger()
httpx_client = httpx_cache.AsyncClient(
headers=headers,
http2=True,
event_hooks={
'request': [httpx_logger.log_request],
'response': [httpx_logger.log_response]
}
)
return httpx_client