tribler.core.libtorrent.trackers
Attributes
Exceptions
The tracker URL is not valid. |
Functions
|
Parses the given tracker URL and returns in a uniform URL format. |
|
Parses the tracker URL and checks whether it satisfies tracker URL constraints. |
|
Parses the tracker URL and check whether it satisfies certain constraints. |
|
Add GET params to provided URL being aware of existing. |
|
Checks whether the given URL is a valid URL. |
Module Contents
- tribler.core.libtorrent.trackers.UDP = 'udp'
- tribler.core.libtorrent.trackers.HTTP = 'http'
- tribler.core.libtorrent.trackers.HTTPS = 'https'
- tribler.core.libtorrent.trackers.SUPPORTED_SCHEMES
- tribler.core.libtorrent.trackers.DEFAULT_PORTS
- exception tribler.core.libtorrent.trackers.MalformedTrackerURLException
Bases:
ExceptionThe tracker URL is not valid.
- tribler.core.libtorrent.trackers.delimiters_regex
- tribler.core.libtorrent.trackers.url_regex
- tribler.core.libtorrent.trackers.remove_trailing_junk
- tribler.core.libtorrent.trackers.truncated_url_detector
- tribler.core.libtorrent.trackers.get_uniformed_tracker_url(tracker_url: str) str | None
Parses the given tracker URL and returns in a uniform URL format. It uses regex to sanitize the URL.
- Parameters:
tracker_url – Tracker URL
- Returns:
the tracker in a uniform format <type>://<host>:<port>/<page>
- tribler.core.libtorrent.trackers.parse_tracker_url(tracker_url: str) tuple[str, tuple[str, int], str]
Parses the tracker URL and checks whether it satisfies tracker URL constraints. Additionally, it also checks if the tracker URL is a uniform and valid URL.
:param tracker_url the URL of the tracker :returns: Tuple (scheme, (host, port), announce_path)
- tribler.core.libtorrent.trackers._parse_tracker_url(tracker_url: str) tuple[str, tuple[str, int], str]
Parses the tracker URL and check whether it satisfies certain constraints.
The tracker type must be one of the supported types (udp, http, https).
UDP trackers requires a port.
HTTP(s) trackers requires an announce path.
HTTP(S) trackers default to HTTP(S)_PORT if port is not present on the URL.
:param tracker_url the URL of the tracker :returns: Tuple (scheme, (host, port), announce_path)
- tribler.core.libtorrent.trackers.add_url_params(url: str, params: dict) str
Add GET params to provided URL being aware of existing.
>> url = ‘http://stackoverflow.com/test?answers=true’ >> new_params = {‘answers’: False, ‘data’: [‘some’,’values’]} >> add_url_params(url, new_params) ‘http://stackoverflow.com/test?data=some&data=values&answers=false’
- Parameters:
url – string of target URL
params – dict containing requested params to be added
- Returns:
string with updated URL