Skip to content

Commit

Permalink
Add recipe to use PEX with requests module and proxies. (#659)
Browse files Browse the repository at this point in the history
Fixes #657
  • Loading branch information
FeatCrush authored and jsirois committed Jan 30, 2019
1 parent 302f988 commit d6e1d67
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/recipes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,30 @@ configuration can be passed in the same way:
$ service.pex myapp:appinstance -c /path/to/gunicorn_config.py
And there you have it, a fully portable python web service.

PEX and Proxy settings
----------------

While building pex files, you may need to fetch dependencies thought a proxy. The easiest way is to use pex cli with the requests extra and environment variables. Following are the steps to do just that:

1) Install pex with requests

.. code-block:: bash
$ pip install pex[requests]
2) Set the environment variables

.. code-block:: bash
$ # Hopefully your proxy supports https! If not, you can export HTTP_PROXY:
$ # export HTTP_PROXY='http://user:pass@address:port'
$ export HTTPS_PROXY='https://user:pass@address:port'
3) Now you can test by running

.. code-block:: bash
$ pex -v pex
For more information on the requests module support for proxies via environment variables, see the official documentation here: http://docs.python-requests.org/en/master/user/advanced/#proxies.

0 comments on commit d6e1d67

Please sign in to comment.