Add helpful error messages when importing optional dependencies (#125)
diff --git a/google/oauth2/oauthlib.py b/google/oauth2/oauthlib.py
index 8f5c105..e1c6089 100644
--- a/google/oauth2/oauthlib.py
+++ b/google/oauth2/oauthlib.py
@@ -27,7 +27,12 @@
import json
-import requests_oauthlib
+try:
+ import requests_oauthlib
+except ImportError: # pragma: NO COVER
+ raise ImportError(
+ 'The requests-oauthlib library is not installed, please install the '
+ 'requests-oauthlib package to use google.oauth2.oauthlib.')
import google.oauth2.credentials