This package provides an adapter to use PyCURL as backend for the requests library.
To be able to use this adapter, you need PyCURL, and, of course, requests.
Clone this project, and then, in the desired virtualenvironment, just run
python setup.py install
PyPI integration comming soon.
Simply import the adapter and mount it
import requests
from requests_curl import CURLAdapter
session = requests.Session()
session.mount("http://", CURLAdapter())
session.mount("https://", CURLAdapter())
response = session.get("https://google.com")
print(response.status_code)
Tests are implemented with pytest. To run tests, just do
pytest tests/
These tests are meant to test that the whole communication with a real server works. For these tests, we use docker compose and the server is based on httpbin.
To run these tests, you will need Docker Compose. First, build the test runner image
docker-compose -f docker-compose.tests.yml build
Then run tests
docker-compose -f docker-compose.tests.yml up --exit-code-from e2e_tests_runner
- 0.1
- Initial release
If you are having trouble installing PyCURL, check this: https://stackoverflow.com/a/51959349.
Also, if you get this error while running tests or using pycurl
import pycurl
E ImportError: pycurl: libcurl link-time ssl backends (secure-transport, openssl) do not include compile-time ssl backend (none/other)
On MacOS these steps worked for me:
- Uninstall pycurl
- Now follow the steps described here: transloadit/python-sdk#4 (comment)