Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class Remove(Interface):
@authenticated
def remove(self, items, **kwargs):
response = self.http.post(
'remove',
data=items,
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return self.get_data(response, **kwargs)
class Delete(Interface):
@authenticated
def delete(self, playbackid, **kwargs):
response = self.http.delete(
path=str(playbackid),
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return 200 <= response.status_code < 300
from __future__ import absolute_import, division, print_function
from trakt.core.helpers import popitems
from trakt.core.pagination import PaginationIterator
from trakt.interfaces.base import Interface, authenticated
from trakt.mapper.sync import SyncMapper
import requests
class Get(Interface):
flags = {}
@authenticated
def get(self, media=None, store=None, params=None, query=None, flat=False, **kwargs):
if not params:
params = []
params.insert(0, media)
# Request resource
response = self.http.get(
params=params,
query=query,
**popitems(kwargs, [
'authenticated',
'validate_token'
class Remove(Interface):
@authenticated
def remove(self, items, **kwargs):
response = self.http.post(
'remove',
data=items,
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return self.get_data(response, **kwargs)
class Delete(Interface):
@authenticated
def delete(self, playbackid, **kwargs):
response = self.http.delete(
path=str(playbackid),
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return 200 <= response.status_code < 300
from trakt.interfaces.base import Interface
from trakt.mapper import ListMapper
# Import child interfaces
from trakt.interfaces.users.lists.list_ import UsersListInterface
__all__ = [
'UsersListsInterface',
'UsersListInterface'
]
class UsersListsInterface(Interface):
path = 'users/*/lists'
def create(self, username, name, description=None, privacy='private',
display_numbers=False, allow_comments=True, **kwargs):
data = {
'name': name,
'description': description,
'privacy': privacy,
'allow_comments': allow_comments,
'display_numbers': display_numbers
}
# Remove attributes with `None` values
for key in list(data.keys()):
if data[key] is not None:
from __future__ import absolute_import, division, print_function
from trakt.core.helpers import popitems
from trakt.interfaces.base import Interface, authenticated
from trakt.mapper.progress import ProgressMapper
from trakt.mapper.summary import SummaryMapper
import requests
class ShowsInterface(Interface):
path = 'shows'
def get(self, id, extended=None, **kwargs):
response = self.http.get(str(id), query={
'extended': extended
})
item = self.get_data(response, **kwargs)
if isinstance(item, requests.Response):
return item
return SummaryMapper.show(self.client, item)
def trending(self, extended=None, **kwargs):
response = self.http.get('trending', query={
return self.get(
'shows',
store,
**kwargs
)
@authenticated
def movies(self, store=None, **kwargs):
return self.get(
'movies',
store,
**kwargs
)
class Add(Interface):
@authenticated
def add(self, items, **kwargs):
response = self.http.post(
data=items,
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return self.get_data(response, **kwargs)
class Remove(Interface):
@authenticated
def remove(self, items, **kwargs):
from trakt.core.helpers import popitems
from trakt.core.pagination import PaginationIterator
from trakt.interfaces.base import authenticated, Interface
from trakt.mapper.sync import SyncMapper
import requests
class Get(Interface):
flags = {}
@authenticated
def get(self, media=None, store=None, params=None, query=None, flat=False, **kwargs):
if not params:
params = []
params.insert(0, media)
# Request resource
response = self.http.get(
params=params,
query=query,
**popitems(kwargs, [
'authenticated',
'validate_token'
class Add(Interface):
@authenticated
def add(self, items, **kwargs):
response = self.http.post(
data=items,
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return self.get_data(response, **kwargs)
class Remove(Interface):
@authenticated
def remove(self, items, **kwargs):
response = self.http.post(
'remove',
data=items,
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return self.get_data(response, **kwargs)
class Delete(Interface):
@authenticated
class Add(Interface):
@authenticated
def add(self, items, **kwargs):
response = self.http.post(
data=items,
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return self.get_data(response, **kwargs)
class Remove(Interface):
@authenticated
def remove(self, items, **kwargs):
response = self.http.post(
'remove',
data=items,
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return self.get_data(response, **kwargs)
class Delete(Interface):
@authenticated
from trakt.interfaces.base import Interface
from trakt.mapper import ListMapper, ListItemMapper
class UsersListInterface(Interface):
path = 'users/*/lists/*'
def get(self, username, id):
response = self.http.get(
'/users/%s/lists/%s' % (username, id),
)
if response.status_code < 200 or response.status_code >= 300:
return None
# Parse response
item = self.get_data(response)
# Map item to list object
return ListMapper.custom_list(
self.client, item,