Compare commits

...

4 Commits

Author SHA1 Message Date
Mads Marquart
813219cd9c Bump version: 1.8.2 → 1.8.3 2019-09-08 15:59:29 +02:00
Asiel Díaz Benítez
bb1f7d9294 Fix mimetypes.guess_type (#471)
`mimetypes.guess_type` fails if the url is something like `http://example.com/file.zip?u=10`.

Backported from 6bffb66
2019-09-08 15:58:34 +02:00
Mads Marquart
3d28c958d3 Bump version: 1.8.1 → 1.8.2 2019-09-05 20:07:44 +02:00
Marco Gavelli
6b68916d74 Fix Python 2 only issue (str.split does not take keyword parameters)
Fixes #469
2019-09-05 20:02:51 +02:00
4 changed files with 6 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.8.1
current_version = 1.8.3
commit = True
tag = True

View File

@@ -13,7 +13,7 @@ from ._client import Client
from ._util import log # TODO: Remove this (from examples too)
__title__ = "fbchat"
__version__ = "1.8.1"
__version__ = "1.8.3"
__description__ = "Facebook Chat (Messenger) for Python"
__copyright__ = "Copyright 2015 - 2019 by Taehoon Kim"

View File

@@ -26,7 +26,7 @@ class EmojiSize(Enum):
"s": cls.SMALL,
}
for tag in tags or ():
data = tag.split(":", maxsplit=1)
data = tag.split(":", 1)
if len(data) > 1 and data[0] == "hot_emoji_size":
return string_to_emojisize.get(data[1])
return None

View File

@@ -219,11 +219,12 @@ def get_files_from_urls(file_urls):
r = requests.get(file_url)
# We could possibly use r.headers.get('Content-Disposition'), see
# https://stackoverflow.com/a/37060758
file_name = basename(file_url).split("?")[0].split("#")[0]
files.append(
(
basename(file_url).split("?")[0].split("#")[0],
file_name,
r.content,
r.headers.get("Content-Type") or guess_type(file_url)[0],
r.headers.get("Content-Type") or guess_type(file_name)[0],
)
)
return files