We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 00f4328 commit 8ad34fcCopy full SHA for 8ad34fc
telegram/inputfile.py
@@ -81,7 +81,8 @@ def __init__(self,
81
self.input_file_content = self.input_file.read()
82
if 'filename' in data:
83
self.filename = self.data.pop('filename')
84
- elif isinstance(self.input_file, file):
+ elif isinstance(self.input_file, file) and \
85
+ hasattr(self.input_file, 'name'):
86
self.filename = os.path.basename(self.input_file.name)
87
elif from_url:
88
self.filename = os.path.basename(self.input_file.url)\
@@ -134,7 +135,7 @@ def to_form(self):
134
135
form_boundary,
136
'Content-Disposition: form-data; name="%s"; filename="%s"' % (
137
self.input_name, self.filename
- ),
138
+ ),
139
'Content-Type: %s' % self.mimetype,
140
'',
141
self.input_file_content
0 commit comments