Skip to content

Commit

Permalink
Update nana.py
Browse files Browse the repository at this point in the history
  • Loading branch information
nanato12 committed Jun 26, 2020
1 parent 7d8483e commit 274de90
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions nanapy/nana.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@ class Nana:

is_login = False

def __init__(self, email=None, password=None, token=None):
if token:
self._service = Service(token=token)
login_type = 'Token'
elif email and password:
self._service = Service(email, password)
login_type = 'Email'
else:
self._service = Service(email, password)
def __init__(self, email=None, password=None, name=None,
token=None, create=False, proxy=None):
self._service = Service(
email=email,
password=password,
name=name,
token=token,
create=create,
proxy=proxy
)
if create:
login_type = 'Create'
self.log(f'email: {self.email}, password: {self.password}')
elif token:
login_type = 'Token'
else:
login_type = 'Email'
self.profile = User(self._service.get_my_info())
self.is_login = True
self.log(
Expand Down Expand Up @@ -59,22 +65,26 @@ def unfollow_user(self, user_id):

@check
def play_post(self, post_id, is_hex=True):
post_id = int(post_id, 16) if is_hex else post_id
if is_hex:
post_id = int(post_id, 16)
self._service.post_play(post_id)

@check
def applause_post(self, post_id, is_hex=True):
post_id = int(post_id, 16) if is_hex else post_id
if is_hex:
post_id = int(post_id, 16)
self._service.post_applause(post_id)

@check
def unapplause_post(self, post_id, is_hex=True):
post_id = int(post_id, 16) if is_hex else post_id
if is_hex:
post_id = int(post_id, 16)
self._service.post_unapplause(post_id)

@check
def comment_post(self, post_id, comment, is_hex=True):
post_id = int(post_id, 16) if is_hex else post_id
if is_hex:
post_id = int(post_id, 16)
self._service.post_comment(post_id, comment)

@check
Expand Down

0 comments on commit 274de90

Please sign in to comment.