Skip to content
Myr

Added multipart_files support for PUT

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 4c192ec · Browse files · 1 file+15 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+15 added−7 removed

  • other:+15 added−7 removed

1 file+15 added−7 removed

modified:requests/core.py+15 added-7 removed
146 unmodified lines
147148 elif self.method == 'PUT':149 if (not self.sent) or anyway:150151 if self.multipart_files:152 register_openers()153 datagen, headers = multipart_encode(self.multipart_files)151 req = _Request(self.url, method='PUT')154 req = _Request(self.url, data=datagen, headers=headers, method='PUT')155153 if self.headers:154 req.headers = self.headers156 if self.headers:157 req.headers.update(self.headers)158156 req.data = self.data159 else:160161 req = _Request(self.url, method='PUT')162163 if self.headers:164 req.headers = self.headers165166 req.data = self.data167168 try:169 opener = self._get_opener()170 resp = opener(req)171
21 unmodified lines
193 else:194 req = _Request(self.url, method='POST')195 req.headers = self.headers196197 # url encode form data if it's a dict198 if isinstance(self.data, dict):199 req.data = urllib.urlencode(self.data)200 else:201 req.data = self.data191 192 # url encode form data if it's a dict202194203 try:204205 opener = self._get_opener()206 resp = opener(req)
216 unmodified lines