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.tar.gz
(1.9 kB
view details)
File details
Details for the file httmock-1.0.tar.gz.
File metadata
- Download URL: httmock-1.0.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd2faa060b47abf7829d93c2a2d89fe8e16fc06a90e93b10a98340d39096c563
|
|
| MD5 |
f314e82a32b5305e54a21eace0fa2007
|
|
| BLAKE2b-256 |
335b0bda4d5794b6d1d6c80049894d9f9c8a9c8095b1e9c65b1bace6511959c6
|