Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def add(self, items, **kwargs):
response = self.http.post(
data=items,
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return self.get_data(response, **kwargs)
def get(self, **kwargs):
response = self.http.get(
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return self.get_data(response, **kwargs)
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'
])
)
# Parse response
items = self.get_data(response, **kwargs)
if isinstance(items, requests.Response):
return items
if type(items) is not list and not isinstance(items, PaginationIterator):
return None
# Map items
return SyncMapper.process(
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'
])
)
# Parse response
items = self.get_data(response, **kwargs)
if isinstance(items, requests.Response):
return items
if type(items) is not list and not isinstance(items, PaginationIterator):
return None
# Map items
return SyncMapper.process(
def progress(self, progress_type, id, hidden=False, specials=False, count_specials=True, **kwargs):
query = {
'hidden': hidden,
'specials': specials,
'count_specials': count_specials
}
response = self.http.get(str(id), [
'progress', progress_type
], query=query, **popitems(kwargs, [
'authenticated',
'validate_token'
]))
item = self.get_data(response, **kwargs)
if isinstance(item, requests.Response):
return item
return ProgressMapper.progress(self.client, progress_type, item)
def delete(self, playbackid, **kwargs):
response = self.http.delete(
path=str(playbackid),
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return 200 <= response.status_code < 300
def like(self, username, id, **kwargs):
# Send request
response = self.http.post(
'/users/%s/lists/%s/like' % (clean_username(username), id),
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return 200 <= response.status_code < 300
def get(self, **kwargs):
response = self.http.get(
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return self.get_data(response, **kwargs)
def unlike(self, username, id, **kwargs):
# Send request
response = self.http.delete(
'/users/%s/lists/%s/like' % (clean_username(username), id),
**popitems(kwargs, [
'authenticated',
'validate_token'
])
)
return 200 <= response.status_code < 300