Skip to content

Commit c690d6a

Browse files
committed
DOC: add version tags for new auth_local_webserver params.
1 parent 4f69ea3 commit c690d6a

File tree

4 files changed

+52
-18
lines changed

4 files changed

+52
-18
lines changed

ci/requirements-2.7-0.19.2.pip

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
google-api-python-client
2-
google-auth
3-
google-auth-httplib2
4-
google-auth-oauthlib
1+
google-api-python-client==1.6.0
2+
google-auth==1.0.0
3+
google-auth-httplib2==0.0.1
4+
google-auth-oauthlib==0.0.1
55
PyCrypto
66
python-gflags==2.0
77
mock

docs/source/changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Changelog
66

77
- Drop support for Python 3.4 (:issue:`40`)
88
- Use the `google-auth <https://google-auth.readthedocs.io/en/latest/>`__ library for authentication because oauth2client is deprecated. (:issue:`39`)
9-
- ``read_gbq`` now has a ``auth_local_webserver`` boolean argument for controlling whether to use web server or console flow when getting user credentials.
9+
- ``read_gbq`` now has a ``auth_local_webserver`` boolean argument for controlling whether to use web server or console flow when getting user credentials. Replaces `--noauth_local_webserver` command line argument (:issue:`35`)
1010

1111
0.1.6 / 2017-05-03
1212
------------------

pandas_gbq/gbq.py

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,28 @@ def _test_google_api_imports():
4141

4242
try:
4343
import httplib2 # noqa
44-
from googleapiclient.discovery import build # noqa
45-
from googleapiclient.errors import HttpError # noqa
46-
import google.auth # noqa
4744
from google_auth_oauthlib.flow import InstalledAppFlow # noqa
4845
import google_auth_httplib2 # noqa
49-
except ImportError as e:
46+
except ImportError as ex:
5047
raise ImportError("Missing module required for Google BigQuery "
51-
"support: {0}".format(str(e)))
48+
"support: {0}".format(str(ex)))
49+
50+
try:
51+
from googleapiclient.discovery import build # noqa
52+
from googleapiclient.errors import HttpError # noqa
53+
except ImportError as ex:
54+
raise ImportError(
55+
"pandas requires google-api-python-client for Google BigQuery "
56+
"support: {0}".format(str(ex)))
57+
58+
try:
59+
import google.auth # noqa
60+
except ImportError as ex:
61+
raise ImportError(
62+
"pandas requires google-auth for Google BigQuery support: "
63+
"{0}".format(str(ex)))
64+
65+
_check_google_client_version()
5266

5367

5468
def _try_credentials(project_id, credentials):
@@ -218,6 +232,8 @@ def load_user_account_credentials(self):
218232
"""
219233
Loads user account credentials from a local file.
220234
235+
.. versionadded 0.2.0
236+
221237
Parameters
222238
----------
223239
None
@@ -261,6 +277,8 @@ def load_user_account_credentials(self):
261277
def save_user_account_credentials(self, credentials):
262278
"""
263279
Saves user account credentials to a local file.
280+
281+
.. versionadded 0.2.0
264282
"""
265283
try:
266284
with open('bigquery_credentials.dat', 'w') as credentials_file:
@@ -750,9 +768,15 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
750768
Service account private key in JSON format. Can be file path
751769
or string contents. This is useful for remote server
752770
authentication (eg. jupyter iPython notebook on remote host)
753-
auth_local_webserver : boolean (default False)
754-
Use a local webserver when getting user credentials to handle
755-
OAuth authorization flow redirects.
771+
auth_local_webserver : boolean, default False
772+
Use the [local webserver flow] instead of the [console flow] when
773+
getting user credentials.
774+
775+
.. [local webserver flow]
776+
http://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_local_server
777+
.. [console flow]
778+
http://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_console
779+
.. versionadded:: 0.2.0
756780
757781
dialect : {'legacy', 'standard'}, default 'legacy'
758782
'legacy' : Use BigQuery's legacy SQL dialect.
@@ -777,6 +801,8 @@ def read_gbq(query, project_id=None, index_col=None, col_order=None,
777801
778802
"""
779803

804+
_test_google_api_imports()
805+
780806
if not project_id:
781807
raise TypeError("Missing required parameter: project_id")
782808

@@ -883,11 +909,19 @@ def to_gbq(dataframe, destination_table, project_id, chunksize=10000,
883909
Service account private key in JSON format. Can be file path
884910
or string contents. This is useful for remote server
885911
authentication (eg. jupyter iPython notebook on remote host)
886-
auth_local_webserver : boolean (default False)
887-
Use a local webserver when getting user credentials to handle
888-
OAuth authorization flow redirects.
912+
auth_local_webserver : boolean, default False
913+
Use the [local webserver flow] instead of the [console flow] when
914+
getting user credentials.
915+
916+
.. [local webserver flow]
917+
http://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_local_server
918+
.. [console flow]
919+
http://google-auth-oauthlib.readthedocs.io/en/latest/reference/google_auth_oauthlib.flow.html#google_auth_oauthlib.flow.InstalledAppFlow.run_console
920+
.. versionadded:: 0.2.0
889921
"""
890922

923+
_test_google_api_imports()
924+
891925
if if_exists not in ('fail', 'replace', 'append'):
892926
raise ValueError("'{0}' is not valid for if_exists".format(if_exists))
893927

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def readme():
2222
'httplib2>=0.9.2',
2323
'google-api-python-client>=1.6.0',
2424
'google-auth>=1.0.0',
25-
'google-auth-httplib2>=0.0.2',
26-
'google-auth-oauthlib>=0.1.0',
25+
'google-auth-httplib2>=0.0.1',
26+
'google-auth-oauthlib>=0.0.1',
2727
]
2828

2929

0 commit comments

Comments
 (0)