« Back to Index

[Tornado configure AsyncHTTPClient to use Curl]

View original Gist on GitHub

Tags: #python3 #tornado #configure #async #httpclient #curl #libcurl

Tornado configure AsyncHTTPClient to use Curl.md

Linux

Install OS dependencies…

apt-get update && apt-get install -y libpq-dev build-essential libcurl4-openssl-dev libssl-dev

Install Python dependencies…

tornado
pycurl

Configure Tornado…

AsyncHTTPClient.configure("tornado.curl_httpclient.CurlAsyncHTTPClient", defaults=dict(user_agent="your_app"))
http_client = AsyncHTTPClient()
http_client.fetch("https://www.integralist.co.uk/")

Notes on macOS

I was getting the following error:

ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)

Resolution:

export PYCURL_SSL_LIBRARY=openssl

pip install --no-cache-dir --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include"  pycurl