{"action":"created","issue":{"url":"https://api.github.com/repos/google/google-api-python-client/issues/220","repository_url":"https://api.github.com/repos/google/google-api-python-client","labels_url":"https://api.github.com/repos/google/google-api-python-client/issues/220/labels{/name}","comments_url":"https://api.github.com/repos/google/google-api-python-client/issues/220/comments","events_url":"https://api.github.com/repos/google/google-api-python-client/issues/220/events","html_url":"https://github.com/google/google-api-python-client/pull/220","id":149835143,"number":220,"title":"googleapiclient.http: guard when importing ssl","user":{"login":"rctay","id":61553,"avatar_url":"https://avatars.githubusercontent.com/u/61553?v=3","gravatar_id":"","url":"https://api.github.com/users/rctay","html_url":"https://github.com/rctay","followers_url":"https://api.github.com/users/rctay/followers","following_url":"https://api.github.com/users/rctay/following{/other_user}","gists_url":"https://api.github.com/users/rctay/gists{/gist_id}","starred_url":"https://api.github.com/users/rctay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rctay/subscriptions","organizations_url":"https://api.github.com/users/rctay/orgs","repos_url":"https://api.github.com/users/rctay/repos","events_url":"https://api.github.com/users/rctay/events{/privacy}","received_events_url":"https://api.github.com/users/rctay/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/google/google-api-python-client/labels/cla:%20yes","name":"cla: yes","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2016-04-20T17:31:20Z","updated_at":"2016-04-27T01:50:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/google/google-api-python-client/pulls/220","html_url":"https://github.com/google/google-api-python-client/pull/220","diff_url":"https://github.com/google/google-api-python-client/pull/220.diff","patch_url":"https://github.com/google/google-api-python-client/pull/220.patch"},"body":"Fix #191 by adding a guard when importing `ssl`, and replace all direct\r\nreferences to `SSLError` (the sole member of `ssl` being used) with a\r\nshim, `_ssl_SSLError`. It is prefixed with a '_' to caution users\r\nagainst relying on the name when importing `googleclient.http`.\r\n\r\n`httplib2` also takes the same approach (see `ssl_SSLError` in\r\n`httplib2/__init__.py`), but instead of using `None` when faking\r\n`SSLError`, we provide a 'real' class, so that code can continue to\r\ntrigger the exception handler for `SSLError` in `googleclient.http` (eg.\r\nin tests, `SSLError`'s are raised). If the shim `_ssl_SSLError` were\r\n`None`, an exception handler for it would not catch anything, as `None`\r\nis not a class and we could never throw anything that could be\r\n\"compatible\" with `None` [1]\r\n\r\n[1] https://docs.python.org/2/reference/compound_stmts.html#except"},"comment":{"url":"https://api.github.com/repos/google/google-api-python-client/issues/comments/214941898","html_url":"https://github.com/google/google-api-python-client/pull/220#issuecomment-214941898","issue_url":"https://api.github.com/repos/google/google-api-python-client/issues/220","id":214941898,"user":{"login":"rctay","id":61553,"avatar_url":"https://avatars.githubusercontent.com/u/61553?v=3","gravatar_id":"","url":"https://api.github.com/users/rctay","html_url":"https://github.com/rctay","followers_url":"https://api.github.com/users/rctay/followers","following_url":"https://api.github.com/users/rctay/following{/other_user}","gists_url":"https://api.github.com/users/rctay/gists{/gist_id}","starred_url":"https://api.github.com/users/rctay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rctay/subscriptions","organizations_url":"https://api.github.com/users/rctay/orgs","repos_url":"https://api.github.com/users/rctay/repos","events_url":"https://api.github.com/users/rctay/events{/privacy}","received_events_url":"https://api.github.com/users/rctay/received_events","type":"User","site_admin":false},"created_at":"2016-04-27T01:50:27Z","updated_at":"2016-04-27T01:50:27Z","body":"You're right, we don't run tests on App Engine, or any environment without `ssl` for that matter. I have dropped the changes to the test infrastructure, as well as omit implementing `SSLError`."}}