Skip to content
Myr

allow files to be upload along with form data

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 b3b2b19 · Browse files · 1 file+11 added−8 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+11 added−8 removed

  • other:+11 added−8 removed

1 file+11 added−8 removed

modified:requests/core.py+11 added-8 removed
66 unmodified lines
67 self.url = url68 self.headers = headers69 self.files = files70 self.method = method71 self.data = data7273 # url encode data if it's a dict74 if hasattr(data, 'items'):74 self.data = urllib.urlencode(data)75 self._enc_data = urllib.urlencode(data)76 else:76 self.data = data77 self._enc_data = data7879 self.response = Response()8081 if isinstance(auth, (list, tuple)):
79 unmodified lines
161 self._checks()162 success = False163164 if self.method in ('GET', 'HEAD', 'DELETE'):164 req = _Request(self._build_url(self.url, self.data), method=self.method)165 req = _Request(self._build_url(self.url, self._enc_data), method=self.method)166 else:167168 if self.files:169 register_openers()168# self.files170171 if self.data:172 self.files.update(self.data)173 174 datagen, headers = multipart_encode(self.files)175 req = _Request(self.url, data=datagen, headers=headers, method=self.method)176 177 else:172 req = _Request(self.url, method=self.method)178 req = _Request(self.url, data=self._enc_data, method=self.method)179174 if self.data:175 req.data = self.data176180 if self.headers:181 req.headers = self.headers182183 if not self.sent or anyway:
312 unmodified lines