Version up, thanks to @orenyomtov and @Abhinav2812

Also fixed `Client.isLoggedIn`
This commit is contained in:
Mads Marquart
2018-05-18 17:35:03 +02:00
parent ffa26c20b5
commit 38f66147cb
4 changed files with 7 additions and 4 deletions

3
.gitignore vendored
View File

@@ -29,3 +29,6 @@ my_tests.py
my_test_data.json
my_data.json
tests.data
# Virtual environment
venv/

View File

@@ -17,7 +17,7 @@ from .client import *
__copyright__ = 'Copyright 2015 - {} by Taehoon Kim'.format(datetime.now().year)
__version__ = '1.3.6'
__version__ = '1.3.7'
__license__ = 'BSD'
__author__ = 'Taehoon Kim; Moreels Pieter-Jan; Mads Marquart'
__email__ = 'carpedm20@gmail.com'

View File

@@ -217,7 +217,7 @@ class Client(object):
else:
self.fb_dtsg = re.search(r'name="fb_dtsg" value="(.*?)"', r.text).group(1)
fb_h_element = soup.find("input", {'name':'h'})
if fb_h_element:
self.fb_h = fb_h_element['value']
@@ -337,7 +337,7 @@ class Client(object):
"""
# Send a request to the login url, to see if we're directed to the home page
r = self._cleanGet(self.req_url.LOGIN, allow_redirects=False)
return 'home' in r.headers['Location']
return 'Location' in r.headers and 'home' in r.headers['Location']
def getSession(self):
"""Retrieves session cookies

View File

@@ -114,7 +114,7 @@ class TestFbchat(unittest.TestCase):
self.assertIsNotNone(client.send(Message(sticker=Sticker(test_sticker_id))))
def test_sendImages(self):
image_url = 'https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-image-128.png'
image_url = 'https://github.com/carpedm20/fbchat/raw/master/tests/image.png'
image_local_url = path.join(path.dirname(__file__), 'tests/image.png')
for thread in threads:
client.setDefaultThread(thread_id=thread['id'], thread_type=thread['type'])