Only urlencode params when using urllib.

The `requests` library expects a dict rather than
a urlencoded string for its 'data' parameter, and
behaves poorly when it receives a string instead.
Merge pull request #174 from ayust/master

Only urlencode params when using urllib.