Skip to content

Commit

Permalink
Refactor Request#__init__
Browse files Browse the repository at this point in the history
  • Loading branch information
jgorset committed May 19, 2011
1 parent 637d033 commit baddc5b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions requests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,16 @@ def __init__(self, url=None, headers=dict(), files=None, method=None,
#: True if :class:`Request <models.Request>` is part of a redirect chain (disables history
#: and HTTPError storage).
self.redirect = redirect

# self.data = {}

if hasattr(data, 'items'):
for (k, v) in data.items():
self.data.update({
k.encode('utf-8') if isinstance(k, unicode) else k:
v.encode('utf-8') if isinstance(v, unicode) else v
})

# url encode data if it's a dict
if hasattr(data, 'items'):
self._enc_data = urllib.urlencode(self.data)
else:
self._enc_data = data
self._enc_data = self.data = data

#: :class:`Response <models.Response>` instance, containing
#: content and metadata of HTTP Response, once :attr:`sent <send>`.
Expand Down

0 comments on commit baddc5b

Please sign in to comment.