lyxint/urlfetch — pull request #2 by ownport (2012-06-27 09:02:41+00:00)
Title: simplify fetch/request interface

A lot of things like basic authentication or Host reassigning can be done via headers. Maybe there's no need to make fetch/request interface complex and leave arguments which are related to requests only

```def fetch(url, data=None, headers={}, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, files={}, prefetch=True)```

All manipulations with headers can be done via Headers class.

Basic authentication
```
h = Headers()
h.basic_auth('username', 'password')
```

Generate random user agent
```
h = Headers()
h.random_user_agent()
```

Then headers can be used in fetch/request as

``` fetch(, headers=h.items())```