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?'
```
=======
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
httmock-1.0.1.tar.gz
(2.3 kB
view details)
File details
Details for the file httmock-1.0.1.tar.gz
.
File metadata
- Download URL: httmock-1.0.1.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b9c0b0c4d35ed9e98c23762f3c09b25a2cce207b4ebf086a357a5cf703377c4 |
|
MD5 | d8d175f497cf01e1ac7320a36eef4ef2 |
|
BLAKE2b-256 | 51ca28ab73ad86fb2ad7537c6a5861ab185b345aa143c55a447ecc723bd2dce0 |