Conform to PEP8 style

This commit is contained in:
Vasilis Gerakaris
2018-10-09 11:42:56 +03:00
parent 95a4468fa3
commit e83c738a04
7 changed files with 87 additions and 57 deletions

View File

@@ -3,14 +3,16 @@ from NyaaPy.utils import Utils
utils = Utils()
class Pantsu:
def __init__(self):
self.BASE_URL = "https://nyaa.pantsu.cat/api"
# Torrents - GET
def search(self, keyword, **kwargs):
request = requests.get("{}/search{}".format(self.BASE_URL, utils.query_builder(keyword, kwargs)))
def search(self, keyword, **kwargs):
request = requests.get("{}/search{}".format(
self.BASE_URL, utils.query_builder(keyword, kwargs)))
return request.json()
def view(self, item_id):
@@ -29,11 +31,13 @@ class Pantsu:
# Users
def login(self, username, password):
login = requests.post("{}/login/".format(self.BASE_URL), data={'username': username, 'password': password})
login = requests.post("{}/login/".format(
self.BASE_URL), data={'username': username, 'password': password})
return login.json()
def profile(self, user_id):
profile = requests.post("{}/profile/".format(self.BASE_URL), data={'id': user_id})
profile = requests.post("{}/profile/".format(
self.BASE_URL), data={'id': user_id})
return profile.json()
return profile.json()