Skip to content

Commit

Permalink
Next Portion
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Oct 25, 2021
1 parent f526086 commit 3d54ae3
Show file tree
Hide file tree
Showing 9 changed files with 0 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ def add_tracker(self, tracker_url):
tracker = db.TrackerState.get_for_update(url=sanitized_url) or db.TrackerState(url=sanitized_url)
self.health.trackers.add(tracker)

def before_update(self):
self.add_tracker(self.tracker_info)

def get_magnet(self):
return (f"magnet:?xt=urn:btih:{hexlify(self.infohash)}&dn={self.title}") + (
f"&tr={self.tracker_info}" if self.tracker_info else ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ def read_payload_with_offset(data, offset=0):
raise UnknownBlobTypeException


def read_payload(data):
return read_payload_with_offset(data)[0]


class SignedPayload(Payload):
"""
Payload for metadata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from tribler_core.utilities.unicode import hexlify

BINARY_FIELDS = ("infohash", "channel_pk")
NO_RESPONSE = unhexlify("7ca1e9e922895a477a52cc9d6031020355eb172735bf83c058cb03ddcc9c6408")


def sanitize_query(query_dict, cap=100):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ class SearchEndpoint(MetadataEndpointBase):
def setup_routes(self):
self.app.add_routes([web.get('', self.search), web.get('/completions', self.completions)])

@staticmethod
def get_uuid(parameters):
return parameters['uuid'] if 'uuid' in parameters else None

@classmethod
def sanitize_parameters(cls, parameters):
sanitized = super().sanitize_parameters(parameters)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
This package contains code for the Tribler HTTP API.
"""

VOTE_UNSUBSCRIBE = 0
VOTE_SUBSCRIBE = 2


def has_param(parameters, name):
return name in parameters and len(parameters[name]) > 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
HTTP_BAD_REQUEST = 400
HTTP_UNAUTHORIZED = 401
HTTP_NOT_FOUND = 404
HTTP_CONFLICT = 409
HTTP_INTERNAL_SERVER_ERROR = 500


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,3 @@ def setup_routes(self):
for path, (ep_cls, enabled) in endpoints.items():
if enabled:
self.add_endpoint(path, ep_cls())

def set_ipv8_session(self, ipv8_session):
if '/ipv8' in self.endpoints:
self.endpoints['/ipv8'].initialize(ipv8_session)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,3 @@

class HandledErrorSchema(Schema):
error = String(description='Optional field describing any failures that may have occurred', required=True)


class UnhandledErrorSchema(Schema):
error = schema(DetailedErrorSchema={'handled': Boolean, 'code': Integer, 'message': String})
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@
import pytest

from tribler_core.config.tribler_config import TriblerConfig
from tribler_core.exceptions import TriblerException
from tribler_core.components.restapi.rest.base_api_test import do_real_request
from tribler_core.components.restapi.rest.rest_endpoint import HTTP_UNAUTHORIZED
from tribler_core.components.restapi.rest.rest_manager import ApiKeyMiddleware, RESTManager, error_middleware
from tribler_core.components.restapi.rest.root_endpoint import RootEndpoint
from tribler_core.tests.tools.common import TESTS_DIR


def RaiseException(*args, **kwargs):
raise TriblerException("Oops! Something went wrong. Please restart Tribler")


@pytest.fixture()
def tribler_config():
return TriblerConfig()
Expand Down

0 comments on commit 3d54ae3

Please sign in to comment.