-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from JuanjoSalvador/user-update
User update
- Loading branch information
Showing
7 changed files
with
68 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
build/ | ||
dist/ | ||
nyaapy.egg-info | ||
.vscode | ||
.vscode | ||
env/ | ||
*.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
import requests | ||
from NyaaPy.utils import Utils as utils | ||
from NyaaPy.utils import Utils | ||
|
||
class Pantsu: | ||
utils = Utils() | ||
|
||
BASE_URL = "https://nyaa.pantsu.cat/api" | ||
class Pantsu: | ||
|
||
def __init__(self): | ||
self.BASE_URL = "https://nyaa.pantsu.cat/api" | ||
|
||
# Torrents - GET | ||
def search(keyword, **kwargs): | ||
request = requests.get("{}/search{}".format(Pantsu.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(item_id): | ||
request = requests.get("{}/view/{}".format(Pantsu.BASE_URL, item_id)) | ||
def view(self, item_id): | ||
request = requests.get("{}/view/{}".format(self.BASE_URL, item_id)) | ||
|
||
return request.json() | ||
|
||
# Torrents - POST | ||
|
||
def upload(): | ||
def upload(self): | ||
return "Work in progress!" | ||
|
||
def update(): | ||
def update(self): | ||
return "Work in progress!" | ||
|
||
# Users | ||
|
||
def login(username, password): | ||
login = requests.post("{}/login/".format(Pantsu.BASE_URL), data={'username': username, 'password': password}) | ||
def login(self, username, password): | ||
login = requests.post("{}/login/".format(self.BASE_URL), data={'username': username, 'password': password}) | ||
|
||
return login.json() | ||
|
||
def profile(user_id): | ||
profile = requests.post("{}/profile/".format(Pantsu.BASE_URL), data={'id': user_id}) | ||
def profile(self, user_id): | ||
profile = requests.post("{}/profile/".format(self.BASE_URL), data={'id': user_id}) | ||
|
||
return profile.json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
from setuptools import setup, find_packages | ||
|
||
setup(name='nyaapy', | ||
version='0.6.1', | ||
version='0.6.2', | ||
install_requires = [ | ||
"requests", | ||
"bs4", | ||
"beautifulsoup4", | ||
], | ||
url='https://github.com/juanjosalvador/nyaapy', | ||
download_url = 'https://github.com/juanjosalvador/nyaapy/archive/0.6.1.tar.gz', | ||
download_url = 'https://github.com/juanjosalvador/nyaapy/archive/0.6.2.tar.gz', | ||
license='MIT', | ||
author='Juanjo Salvador', | ||
author_email='[email protected]', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
from NyaaPy import Pantsu | ||
from NyaaPy import Pantsu, Nyaa | ||
|
||
print(Pantsu.search('koe no katachi', lang=["es", "ja"], category=[1, 3])) | ||
pantsu = Pantsu() | ||
nyaa = Nyaa() | ||
|
||
#print(pantsu.search(keyword='koe no katachi', lang=["es", "ja"], category=[1, 3])) | ||
print(nyaa.search(keyword='yuru camp')) |