Comments (15)
Can you verify the key you're reading in is a valid PKCS12 or PEM key? This error occurs if the string isn't a valid key.
from bigquery-python.
@tylertreat can you explain more clearly?
mykey is generate form
https://console.developers.google.com/project/foretribebigquery/apiui/credential
I generate server key:
Client ID for web application
Client ID
876306077634-b81mhps17flaq8r5fprqrb8cugjj66ro.apps.googleusercontent.com
Email address
876306077634-b81mhps17flaq8r5fprqrb8cugjj66ro@developer.gserviceaccount.com
Client secret
YdV3Rt5Br-lKy5lhqf5ZqY8C
Redirect URIs
http://localhost:8080/
Javascript Origins
http://localhost:8080/
from bigquery-python.
You need to create a client id for service account.
This will download a .p12 file to your machine which is the key you should use.
from bigquery-python.
I did it but still get error.
from bigquery-python.
Did you mean to include an image? I don't see anything...
from bigquery-python.
hi @tylertreat can you see it?
from bigquery-python.
Yes, your image shows a client id for web application. You need to create a client id for service account. Then use the key it downloads to your machine.
from bigquery-python.
It should look something like this:
from bigquery-python.
Does the secret_key equals private key in json file?
the key begin after "-----BEGIN PRIVATE KEY-----\n" or including all of them?
"private_key": "-----BEGIN PRIVATE KEY-----\nMIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBALJMlDzSxPlodfrc\nkTnnBi9M1gsXmkZzuupIO8tpXGiYiQo4QXHsIr2HyG10zB0q11qSTKMFaSar/YeE\nYGsdR6b5nESSuOu2NfZXOHIbUfVXvq1JuTOkjQW0oM9ixbqN1hX3H84R3rHPq4SY\n9Yakud2yq4rcFT5yhjyW5yBcFdJBAgMBAAECgYBmy2/LgVi+0lLyxqeT0nXmX04o\nJvtzEtX4rJyMsbntM8QOeFCC9bkxvE75jBUB2+k89ovokP4GpbINp2xPVRoxWqh5\nfpCE0TWlL1Q+EbB09NPcFIpk7R+VwlwtvkMHZ9LoAo4gVa5U4mscBV3mnOJC0shJ\n9RlHB1evt41ATTr6AQJBAOx7s+RH22yEQ22aqBxn7BvswA/HFay+hCix3bCG79oI\nCuO0lb0AIT/4etPnS4Ae1s1wgLH85k6xpJADDwfd6AkCQQDBA5e7+o2ltsAolyPF\nCRp9EyBkIDvWR1vcyncEyn0Cp4GUmMj5HO9NhIruj9t0xAGahJ1zhJ0U7vFbvSar\nB3Z5AkEAwS+lG53gENxTwRwQrXPwHDfiBoGaoU3Z5Oy4r9br5e+gBbimgomyn/G7\nVZSjxvxqedWoLL7u3eadCtCU3NZZEQJAGjqswgTYfu6IyntPhxUnnludCT5AI2xr\nFWQGLIZ/2n58436nwQKnmncqkiTGg+Wm+iKPawVYe2HFNtxLhu5qsQJBAJVAAF2n\nE+3hIxa+kCZJq4wQkkYMkZl7pke8d8/EV67Nh9jzdMBK6ZLTdIhbm9XuwiGp23m+\n+EuUfaJ2iIkIhYk\u003d\n-----END PRIVATE KEY-----\n"
from bigquery-python.
Yes, or the .p12 key.
I also added a new private_key_file
kwarg which lets you provide the file name instead of reading it into a string.
NOTE: this key is PRIVATE and should not be shared with anyone. Now that you've posted it online here, you need to generate a new, secure one.
from bigquery-python.
Do you know why after:
client=get_client(project_id, service_account=service_account, private_key=secret_key, readonly=True)
get the error:
Error: [('asn1 encoding routines', 'ASN1_CHECK_TLEN', 'wrong tag'), ('asn1 encoding routines', 'ASN1_ITEM_EX_D2I', 'nested asn1 error')]
from bigquery-python.
Are you using the .p12 key?
from bigquery-python.
This is my .p12 key.
https://drive.google.com/file/d/0B9ncCBd_xIXqZDhKRktYLVI5dms/view?usp=sharing
But after I use it to authority:
client=get_client(project_id, service_account=service_account, private_key_file="key.p12", readonly=True)
get an error is:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\flask\app.py", line 1836, in call
return self.wsgi_app(environ, start_response)
File "C:\Python27\lib\site-packages\flask\app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "C:\Python27\lib\site-packages\flask\app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "C:\Python27\lib\site-packages\flask\app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "C:\Python27\lib\site-packages\flask\app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Python27\lib\site-packages\flask\app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Python27\lib\site-packages\flask\app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Python27\lib\site-packages\flask\app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\personal\foretribebigquery\app\routes\index.py", line 41, in googledata
client=get_client(project_id, service_account=service_account, private_key_file="key.p12", readonly=True)
File "C:\personal\foretribebigquery\bigquery\client.py", line 85, in get_client
readonly=readonly)
File "C:\personal\foretribebigquery\bigquery\client.py", line 103, in _get_bq_service
service = build('bigquery', 'v2', http=http)
File "C:\Python27\lib\site-packages\oauth2client\util.py", line 135, in positional_wrapper
return wrapped(_args, *_kwargs)
File "C:\Python27\lib\site-packages\googleapiclient\discovery.py", line 198, in build
resp, content = http.request(requested_url)
File "C:\Python27\lib\site-packages\oauth2client\util.py", line 135, in positional_wrapper
return wrapped(_args, *_kwargs)
File "C:\Python27\lib\site-packages\oauth2client\client.py", line 530, in new_request
self._refresh(request_orig)
File "C:\Python27\lib\site-packages\oauth2client\client.py", line 744, in _refresh
self._do_refresh_request(http_request)
File "C:\Python27\lib\site-packages\oauth2client\client.py", line 807, in _do_refresh_request
raise AccessTokenRefreshError(error_msg)
AccessTokenRefreshError: invalid_grant
from bigquery-python.
Do the p12 file will read directly?
on your client.py
with open(private_key_file, 'rb') as key_file:
private_key = key_file.read()
from bigquery-python.
Yeah, that should work. The json file won't work.
On Mon, Jan 26, 2015, 5:59 PM thinksource [email protected] wrote:
Do the p12 file will read directly?
on your client.pywith open(private_key_file, 'rb') as key_file: private_key = key_file.read()
—
Reply to this email directly or view it on GitHub
#41 (comment)
.
from bigquery-python.
Related Issues (20)
- ImportError: cannot import name get_client HOT 6
- Queries results limited HOT 1
- get statistics of the job HOT 1
- specifying dataset location when using create_dataset method HOT 2
- create_table() documentation incorrect HOT 1
- Table expiration time should be a long HOT 1
- Functionality to upload/download file from local to gcs and vice versa
- not working anymore due to KeyError: 'google'
- Get Client with API key
- documentation typo "destination_urls" HOT 1
- bigquery.errors.JobInsertException: Reason:invalid. Message:Table wasel-95b26:com_mysada_news_ANDROID.app_events_20170611 cannot be exported as CSV because it has a nested schema. HOT 1
- get_query_rows offset option fails across pages
- Few typos in documentation HOT 1
- Cannot import get_client
- ImportError: No module named bigquery
- Not getting the full list of datasets when there are more than 50 datasets in the project HOT 1
- Standard SQL support HOT 3
- "Please look into the error stream for more details." HOT 5
- Request had insufficient authentication scopes when creating a table HOT 6
- Is this project still ongoing?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bigquery-python.