diff --git a/.gitignore b/.gitignore index 242e8f95d..84868c99b 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,5 @@ docs/_build/ # PyBuilder target/ +.idea/ +.gitignore diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 000000000..922003b84 --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 000000000..988f066d9 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,471 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + 1436540850238 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/telegram/bot.py b/telegram/bot.py index 12e333c79..29705730f 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -602,10 +602,10 @@ class Bot(object): """ if method == 'POST': - if 'audio' in data and (isinstance(data['audio'], file) or 'http' in data['audio']) or \ - 'document' in data and (isinstance(data['document'], file) or 'http' in data['document']) or \ - 'photo' in data and (isinstance(data['photo'], file) or 'http' in data['photo']) or \ - 'video' in data and (isinstance(data['video'], file) or 'http' in data['video']): + file_type = ['audio', 'document', 'photo', 'video'] + # len(dict{key1: val1, key2: val2}) == 2, it is used in case data is None + if len(data) >= 2 and data.keys()[1] in file_type and \ + (isinstance(data.items()[1], file) or str(data.items()[1]).startswith('http')): try: data = InputFile(data) request = urllib2.Request(