Skip to content

Commit

Permalink
Merge branch 'develop' into feature/calendar-object
Browse files Browse the repository at this point in the history
  • Loading branch information
tomerghelber committed Oct 3, 2014
2 parents d13e506 + 3edbb6f commit 42be589
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 10 deletions.
3 changes: 1 addition & 2 deletions pymal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@
__all__ = ['account', 'anime', 'manga', 'seasons']


def get_version():
return '0.5b4'
__version__ = '0.6'
9 changes: 7 additions & 2 deletions pymal/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Account(object, metaclass=singleton_factory.SingletonFactory):
request.urljoin(HOST_NAME, r'api/account/verify_credentials.xml')

__MY_LOGIN_URL = request.urljoin(HOST_NAME, 'login.php')
__DATA_FORM = 'username={0:s}&password={1:s}&cookie=1&sublogin=Login'
__DATA_FORM = 'username={0:s}&password={1:s}&cookie=1&sublogin=+Login+'

def __init__(self, username: str, password: str or None=None):
"""
Expand Down Expand Up @@ -178,7 +178,12 @@ def change_password(self, password: str) -> bool:
self.__password = password

data_form = self.__DATA_FORM.format(self.username, password).encode('utf-8')
self.connect(self.__MY_LOGIN_URL, data=data_form)
headers = {
'content-type': 'application/x-www-form-urlencoded',
'name': 'loginForm',
}

self.auth_connect(self.__MY_LOGIN_URL, data=data_form, headers=headers)

return True

Expand Down
5 changes: 4 additions & 1 deletion pymal/account_objects/account_animes.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ def reload(self):
def __get_my_animes(self, status: int) -> frozenset:
import bs4

data = self.__account.connect(self.__url + str(status))
if self.__account.is_auth:
data = self.__account.auth_connect(self.__url + str(status))
else:
data = self.__account.connect(self.__url + str(status))
body = bs4.BeautifulSoup(data).body

main_div = body.find(name='div', attrs={'id': 'list_surround'})
Expand Down
5 changes: 4 additions & 1 deletion pymal/account_objects/account_mangas.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ def reload(self):
def __get_my_animes(self, status: int) -> frozenset:
import bs4

data = self.__account.connect(self.__url + str(status))
if self.__account.is_auth:
data = self.__account.auth_connect(self.__url + str(status))
else:
data = self.__account.connect(self.__url + str(status))
body = bs4.BeautifulSoup(data).body

main_div = body.find(name='div', attrs={'id': 'list_surround'})
Expand Down
6 changes: 5 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# This is an implicit value, here for clarity
--index-url https://pypi.python.org/simple/

# Those are like in setup.py
beautifulsoup4>=4.3.2
html5lib>=0.999
httpcache>=0.1.3
coveralls>=0.4.2
six==1.3
requests>=2.4.1
pillow>=2.5.3
singleton3>=1.0
singleton-factory>=0.1

# This is needed for tests
coveralls>=0.4.2
mock==1.0.1
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from setuptools import setup, find_packages


# Dynamically calculate the version based on pymal.VERSION.
version = __import__('pymal').get_version()
# Dynamically calculate the version based on pymal.__version__.
version = __import__('pymal').__version__


setup(
Expand Down
1 change: 1 addition & 0 deletions tests/account_objects/test_account_animes.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def test_issubset(self):
operator = self.animes <= self.friend_animes
self.assertEqual(regular, operator)

@unittest.skip('need to re think about this')
def test_issuperset(self):
regular = self.animes.issubset(self.friend_animes)
operator = self.animes >= self.friend_animes
Expand Down
3 changes: 2 additions & 1 deletion tests/test_anime.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import unittest
from unittest.mock import Mock
import os
from os import path

from mock import Mock

from pymal import account
from pymal import anime
from pymal import manga
Expand Down

0 comments on commit 42be589

Please sign in to comment.