Skip to content

Commit

Permalink
Fix documentation issue with swagger extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
xoriole committed Sep 20, 2021
1 parent 12e2403 commit 3e23fc5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions doc/extract_swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,20 @@
import aiohttp

from tribler_core.config.tribler_config import TriblerConfig
from tribler_core.restapi.rest_manager import RESTManager
from tribler_core.restapi.rest_manager import ApiKeyMiddleware, error_middleware, RESTManager
from tribler_core.restapi.root_endpoint import RootEndpoint

import yaml


async def extract_swagger(destination_fn):
session = Mock()
session.config = TriblerConfig()
session.config.api.key = 'apikey'
session.config.api.http_enabled = False
session.config.api.https_enabled = False
api_manager = RESTManager(session)
config = TriblerConfig()
config.api.key = 'apikey'
config.api.http_enabled = False
config.api.https_enabled = False

root_endpoint = RootEndpoint(config, middlewares=[ApiKeyMiddleware(config.api.key), error_middleware])
api_manager = RESTManager(config=config.api, root_endpoint=root_endpoint, state_dir=config.state_dir)
await api_manager.start()

fp = StringIO()
Expand Down

0 comments on commit 3e23fc5

Please sign in to comment.