tribler.core.restapi.statistics_endpoint ======================================== .. py:module:: tribler.core.restapi.statistics_endpoint Classes ------- .. autoapisummary:: tribler.core.restapi.statistics_endpoint.Socks5StatsDict tribler.core.restapi.statistics_endpoint.LibtorrentSessionStatsDict tribler.core.restapi.statistics_endpoint.LibtorrentStatsDict tribler.core.restapi.statistics_endpoint.TriblerStatsDict tribler.core.restapi.statistics_endpoint.StatisticsEndpoint Module Contents --------------- .. py:class:: Socks5StatsDict Bases: :py:obj:`TypedDict` Socks5 statistics entry. .. py:attribute:: hops :type: int .. py:attribute:: sessions :type: int .. py:attribute:: associates :type: list[int] | None .. py:class:: LibtorrentSessionStatsDict Bases: :py:obj:`TypedDict` Statistics for a single libtorrent session. .. py:attribute:: recv_bytes :type: int .. py:attribute:: sent_bytes :type: int .. py:attribute:: dht_recv_bytes :type: int .. py:attribute:: dht_sent_bytes :type: int .. py:attribute:: tracker_recv_bytes :type: int .. py:attribute:: tracker_sent_bytes :type: int .. py:attribute:: payload_recv_bytes :type: int .. py:attribute:: payload_sent_bytes :type: int .. py:attribute:: hops :type: int .. py:class:: LibtorrentStatsDict Bases: :py:obj:`TypedDict` Statistics for the entirety of libtorrent. .. py:attribute:: sessions :type: list[LibtorrentSessionStatsDict] .. py:attribute:: total_recv_bytes :type: int .. py:attribute:: total_sent_bytes :type: int .. py:class:: TriblerStatsDict Bases: :py:obj:`TypedDict` Tribler statistics. .. py:attribute:: peers :type: NotRequired[int] .. py:attribute:: db_size :type: NotRequired[int] .. py:attribute:: num_torrents :type: NotRequired[int] .. py:attribute:: endpoint_version :type: NotRequired[str | None] .. py:attribute:: socks5_sessions :type: NotRequired[list[Socks5StatsDict]] .. py:attribute:: libtorrent :type: NotRequired[LibtorrentStatsDict] .. py:class:: StatisticsEndpoint(middlewares: tuple = (), client_max_size: int = MAX_REQUEST_SIZE) Bases: :py:obj:`tribler.core.restapi.rest_endpoint.RESTEndpoint` This endpoint is responsible for handing requests regarding statistics in Tribler. .. py:attribute:: path :value: '/api/statistics' .. py:attribute:: session :type: tribler.core.session.Session | None :value: None .. py:attribute:: content_discovery_community :type: tribler.core.content_discovery.community.ContentDiscoveryCommunity | None :value: None .. py:method:: get_tribler_stats(_: aiohttp.web.Request) -> tribler.core.restapi.rest_endpoint.RESTResponse Return general statistics of Tribler. .. py:method:: get_ipv8_stats(_: aiohttp.web.Request) -> tribler.core.restapi.rest_endpoint.RESTResponse Return general statistics of IPv8. .. py:method:: get_dirspace_stats(request: aiohttp.web.Request) -> tribler.core.restapi.rest_endpoint.RESTResponse :async: Return disk space statistics for a given directory. This method fits the download logic: if the given directory does not exist, the folder is created. So, to account for future folders, this method returns the stats for the first parent folder of the given folder if it does not exist (yet).