Skip to main content

A mocking library for requests.

Project description

httmock
=======

A mocking library for `requests`

------

You can use it to mock third-party APIs and test libraries that use `requests` internally:

```python
from httmock import urlmatch, HTTMock
import requests

@urlmatch(netloc=r'(.*\.)?google\.com$')
def google_mock(url, request):
return 'Feeling lucky, punk?'

with HTTMock(google_mock):
r = requests.get('http://google.com/')
print r.content # 'Feeling lucky, punk?'
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for httmock, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size httmock-1.0.1.tar.gz (2.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page