jaimegildesagredo/finch — pull request #13 by paulmelnikow (2014-09-30 03:05:29+00:00)
Title: Allow configuring a base URL

In a REST client, it's useful to be able to set a base URL, to which other resource URLs are relative. In fact I think this is a key feature.

It's particularly useful with APIs where the hostname portion of the base URL includes the account, or when testing an API against multiple endpoints (such as development, staging, and production). By setting the base URL once when configuring the client, the collections don't need to concern themselves with it.

Here's an example with a URL based on the account name:

```py
from finch.session import Session

class Client(Session):
def __init__(self, http_client, account_name, **kwargs):
url = "https://%s.api.example.com" % account_name
super(Client, self).__init__(http_client, base_url=url, **kwargs)
```