Skip to content
Myr

Implemented idna (fixes #76).

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

authored by Jérémy Bethmont · committed by Jérémy Bethmont · parent 39edf7a · Browse files · 2 files+8 added−1 removed
This commit

State

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

Diff stats

2 files+8 added−1 removed

  • other:+8 added−1 removed

2 files+8 added−1 removed

modified:requests/models.py+5 added-1 removed
10 unmodified lines
11import socket12import zlib1314from urllib2 import HTTPError15from urlparse import urlparse15from urlparse import urlparse, urlunparse16from datetime import datetime1718from .config import settings19from .monkeys import Request as _Request, HTTPBasicAuthHandler, HTTPDigestAuthHandler, HTTPRedirectHandler
217 unmodified lines
237238 def _build_url(self):239 """Build the actual URL to use"""240241 parsed_url = list(urlparse(self.url))242 parsed_url[1] = parsed_url[1].encode('idna')243 self.url = urlunparse(parsed_url)244245 if self._enc_params:246 if urlparse(self.url).query:247 return '%s&%s' % (self.url, self._enc_params)248 else:
304 unmodified lines
modified:test_requests.py+3 added
319 unmodified lines
320 rbody = json.loads(r.content)321 self.assertEquals(rbody.get('form'), None)322 self.assertEquals(rbody.get('data'), 'foobar')323324 def test_idna(self):325 r = requests.get(u'http://➡.ws/httpbin')326 self.assertEqual(r.url, HTTPBIN_URL)327328329if __name__ == '__main__':330 unittest.main()