diff --git a/pypac/api.py b/pypac/api.py
index 6b8c089..4541be4 100644
--- a/pypac/api.py
+++ b/pypac/api.py
@@ -301,8 +301,9 @@ def pac_context_for_url(url, proxy_auth=None):
     if pac:
         resolver = ProxyResolver(pac, proxy_auth=proxy_auth)
         proxies = resolver.get_proxy_for_requests(url)
-        os.environ['HTTP_PROXY'] = proxies.get('http')
-        os.environ['HTTPS_PROXY'] = proxies.get('https')
+        # Cannot set None for environ. (#27)
+        os.environ['HTTP_PROXY'] = proxies.get('http') or ''
+        os.environ['HTTPS_PROXY'] = proxies.get('https') or ''
     yield
     if prev_http_proxy:
         os.environ['HTTP_PROXY'] = prev_http_proxy

diff --git a/tests/test_api.py b/tests/test_api.py
index 2adb5fc..255da3b 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -368,3 +368,11 @@ class TestContextManager(object):
                 assert os.environ['HTTP_PROXY'] == fake_proxy_url
                 assert os.environ['HTTPS_PROXY'] == fake_proxy_url
         assert os.environ['HTTP_PROXY'] == 'http://env'
+
+    def test_pac_direct(self, monkeypatch):
+        monkeypatch.setenv('HTTP_PROXY', 'http://env')
+        with _patch_get_pac(PACFile(proxy_pac_js_tpl % 'DIRECT')):
+            with pac_context_for_url(arbitrary_url):
+                assert os.environ['HTTP_PROXY'] == ''
+                assert os.environ['HTTPS_PROXY'] == ''
+        assert os.environ['HTTP_PROXY'] == 'http://env'

"TypeError: putenv() argument 2 must be string, not None" Error when using pac_context_for_url
pypac version: 0.9.0 (retrieved from pip)
Python version: Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AMD64)] on win32

When the configured pac file returns "DIRECT" for a URL then the function will fail with the following error:
```
  File "file.py", line 27, in get_job_info
    with pac_context_for_url('http://' + self.host):
  File "C:\Python27\lib\contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "C:\Python27\lib\site-packages\pypac\api.py", line 305, in pac_context_for_url
    os.environ['HTTP_PROXY'] = proxies.get('http')
  File "C:\Python27\lib\os.py", line 422, in __setitem__
    putenv(key, item)
TypeError: putenv() argument 2 must be string, not None
```

In this case the pac file will return "DIRECT" for the url - the code gets to line 303
`proxies = resolver.get_proxy_for_requests(url)`
which will result in the code going to pypac/resolver.py:133  and the function  proxy_parameter_for_requests("DIRECT") will be called. This will then set proxy_url_or_direct to None which will be used for the returns values in the dictionary for 'http' and 'https'. These value of None are used in
```
os.environ['HTTP_PROXY'] = proxies.get('http')
os.environ['HTTPS_PROXY'] = proxies.get('https')
```
Resulting in the error putenv() argument 2 must be string, not None
tests/test_api.py::TestContextManager::test_pac_direct
tests/test_api.py::TestApiFunctions::test_download_pac_not_ok tests/test_api.py::TestApiFunctions::test_registry_filesystem_path tests/test_api.py::TestApiFunctions::test_download_pac_timeout tests/test_api.py::TestApiFunctions::test_download_pac_content_type[headers1-None-None] tests/test_api.py::TestApiFunctions::test_get_pac_via_js tests/test_api.py::TestApiFunctions::test_download_pac_content_type[headers0-None-function tests/test_api.py::TestApiFunctions::test_collect_pac_urls tests/test_api.py::TestApiFunctions::test_get_pac_autodetect tests/test_api.py::TestApiFunctions::test_get_pac_via_url tests/test_api.py::TestApiFunctions::test_download_pac_content_type[headers2-allowed_content_types2-function tests/test_api.py::TestRequests::test_unreachable_proxy[127.0.0.1] tests/test_api.py::TestRequests::test_environment_proxies[http://c.local/x.html-expected_proxies4-http://env] tests/test_api.py::TestRequests::test_environment_proxies[http://a.local/x.html-expected_proxies0-None] tests/test_api.py::TestRequests::test_unreachable_proxy[unreachable.local] tests/test_api.py::TestRequests::test_unreachable_proxy[localhost] tests/test_api.py::TestRequests::test_unreachable_proxy[0.0.0.0] tests/test_api.py::TestRequests::test_environment_proxies[http://foo.b.local/x.html-expected_proxies2-None] tests/test_api.py::TestRequests::test_environment_proxies[http://foob.local/x.html-expected_proxies3-http://env] tests/test_api.py::TestRequests::test_environment_proxies[http://fooa.local/x.html-expected_proxies1-None] tests/test_api.py::TestRequests::test_supercede_environment_settings tests/test_api.py::TestRequests::test_override_env_proxy_and_go_direct tests/test_api.py::TestContextManager::test_no_pac_no_env tests/test_api.py::TestContextManager::test_no_pac tests/test_api.py::TestContextManager::test_pac tests/test_api.py::TestPACSession::test_default_behaviour_no_pac_found tests/test_api.py::TestPACSession::test_pac_from_constructor tests/test_api.py::TestPACSession::test_post_init_proxy_auth tests/test_api.py::TestPACSession::test_pac_no_failover_available_exc_case tests/test_api.py::TestPACSession::test_pac_failover_to_direct tests/test_api.py::TestPACSession::test_default_behaviour_pac_found tests/test_api.py::TestPACSession::test_pac_override_using_request_proxies_parameter tests/test_api.py::TestPACSession::test_bad_proxy_no_failover[localhost] tests/test_api.py::TestPACSession::test_failover_using_custom_response_filter tests/test_api.py::TestPACSession::test_failover_using_custom_exception_criteria tests/test_api.py::TestPACSession::test_pac_disabled tests/test_api.py::TestPACSession::test_pac_failover tests/test_api.py::TestPACSession::test_no_pac_but_call_get_pac_twice tests/test_api.py::TestPACSession::test_pac_failover_to_direct_also_fails tests/test_api.py::TestPACSession::test_bad_proxy_no_failover[unreachable.local]