Skip to content

Commit

Permalink
Readme improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
carsonyl committed Jun 13, 2016
1 parent 2caf06d commit 56bb999
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ PyPAC: Proxy auto-config for Python
.. image:: https://img.shields.io/codacy/grade/71ac103b491d44efb94976ca5ea5d89c.svg?maxAge=2592000
:target: https://www.codacy.com/app/carsonyl/pypac

PyPAC is a pure-Python library for finding, downloading, and parsing
`proxy auto-config (PAC) <https://en.wikipedia.org/wiki/Proxy_auto-config>`_ files.
PAC files are often used in organizations that need fine-grained control of proxy settings.
PyPAC supports Python 2.7 and 3.3+.
PyPAC is a pure-Python library for finding `proxy auto-config (PAC)`_ files and making HTTP requests
that respect them. PAC files are often used in organizations that need fine-grained and centralized control
of proxy settings. PyPAC supports Python 2.7 and 3.3+.

.. _proxy auto-config (PAC): https://en.wikipedia.org/wiki/Proxy_auto-config

PyPAC provides a subclass of a `Requests <http://docs.python-requests.org/en/master/>`_ ``Session``,
so you can start using it immediately, with the PAC file transparently discovered and honoured:
so you can start using it immediately, with any PAC file transparently discovered and honoured:

.. code-block:: python
Expand All @@ -27,15 +28,18 @@ so you can start using it immediately, with the PAC file transparently discovere
>>> session.get('http://example.org')
...
PyPAC can find PAC files according to the DNS portion of the
`Web Proxy Auto-Discovery (WPAD) <https://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol>`_ protocol.
On Windows, PyPAC can obtain the PAC file URL from the registry.
If a PAC file isn't found, then ``PACSession`` acts exactly like a regular ``Session``.

PyPAC can find PAC files according to the DNS portion of the `Web Proxy Auto-Discovery (WPAD)`_ protocol.
On Windows, PyPAC can also obtain the PAC file URL from the Internet Options dialog, via the registry.

.. _Web Proxy Auto-Discovery (WPAD): https://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol


Proxy authentication
--------------------

Basic proxy authentication can be specified via the PACSession constructor:
Basic proxy authentication can be specified in the PACSession constructor:

.. code-block:: python
Expand All @@ -46,7 +50,7 @@ Basic proxy authentication can be specified via the PACSession constructor:
...
To use NTLM authentication with proxies, install `requests-ntlm <https://github.com/requests/requests-ntlm>`_
and try setting ``PACSession.auth`` to an ``HttpNtlmAuth`` instance.
and set ``PACSession.auth`` to an ``HttpNtlmAuth`` instance.


Security
Expand All @@ -58,18 +62,22 @@ and so it is unclear whether the handling of PAC files is sufficiently sandboxed
untrusted Python code execution.

When looking for a PAC file using DNS WPAD, the local machine's fully-qualified hostname is
checked against the Mozilla Public Suffix List to prevent requesting any PAC files outside
checked against the `Mozilla Public Suffix List`_ to prevent requesting any PAC files outside
the scope of the organization. If the hostname's TLD isn't in the Public Suffix List, then
everything up to the final node is used in the search path. For example, a hostname of
foo.bar.local will result in a search for a PAC file from wpad.bar.local and wpad.local.

PyPAC uses the `tld <https://pypi.python.org/pypi/tld>`_ library to match TLDs.

.. _Mozilla Public Suffix List: https://publicsuffix.org/


What's missing
--------------

The DHCP portion of the Web Proxy Auto-Discovery (WPAD) protocol is not implemented.

PyPAC currently works with Requests by including a subclass of Session.
PyPAC currently works with Requests by including a subclass of ``Session``.
No ready-to-use solutions are included for other HTTP libraries,
though PyPAC has all the building blocks needed to make one easily.

Expand Down

0 comments on commit 56bb999

Please sign in to comment.