kennethreitz/requests — pull request #817 by msabramo (2012-08-27 21:26:03+00:00)
Title: Add a `add_params` method to the `Session` class.

Otherwise, it's tricky for clients to write code that adds params without them poking inside the innards of `Session`, which can be problematic when the implementation changes.

This was motivated by the fact that I just ran some code of mine that depends on requests and it failed, because my virtualenv had a newer version of requests (0.13.9) and the code was written against 0.13.1 and had code that looked like this:

```python
self.session.params['access_token'] = response_obj['access_token']
```

I do this to add an `access_token` parameter after the user logs in and obtains an access token, because this parameter is needed on subsequent requests after the login.

This worked in 0.13.1, because in 0.13.1, `session.params` was a dict, but it is now a list of tuples. The problem arises because there was no public interface for setting params and because this is Python, one can manipulate the attributes of the class whenever they desire. When the implementation changes, this breaks code that relies on that implementation.

So I propose to add a `add_params` method to `Session`, which is the official interface for clients to use to add parameters and it can change in the future if the implementation changes and clients code will still work.

I guess this is all a really long way of saying...abstraction :-)