-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test all links and code examples in docs for GA/Beta. #3172
Comments
Moving discussion from #3206 (comment) to this thread. @lukesneeringer so here's the current status of snippets for GA.
The Right Thing™ to do is probably update the BigQuery and Storage snippets to the same methodology that Datastore is using. I think that can be done in reasonable time. I thought this was already a known, and that's why manual testing was the preferred route for now. |
There is an inflection point where doing things "by hand" starts to become longer than doing it the right way |
@dhermes logging_snippets.py looks fairly outdated. ╰─$ python docs/logging_snippets.py
instantiate_client : Instantiate client.
ERROR: ValueError('This library only supports credentials from google-auth-library-python. See https://google-cloud-python.readthedocs.io/en/latest/google-cloud-auth.html for help on authentication with this library.',)
client_list_entries : List entries via client.
ERROR: TypeError('Can not find message descriptor by type_url: type.googleapis.com/google.cloud.audit.AuditLog.',)
logger_usage : Logger usage.
metric_crud : Metric CRUD.
sink_storage : Sink log entries to storage.
sink_bigquery : Sink log entries to bigquery.
sink_pubsub : Sink log entries to pubsub.
logging_handler : None
ERROR: TypeError('logging_handler() takes exactly 1 argument (2 given)',)
setup_logging : None
ERROR: TypeError('setup_logging() takes exactly 1 argument (2 given)',) |
I am unaware of how up to date it is, just posted as a response to "Logging snippet tests do not exists." |
@dhermes yeah thanks! I updated the status in the list. |
@dhermes the Storage snippet for generate_upload_policy seems to be broken. I looked at the docs but I don't see where the breakdown is. Here's the output when trying to upload with the generated HTML form. <Error>
<Code>InvalidArgument</Code>
<Message>Invalid argument.</Message>
<Details>Cannot create buckets using a POST.</Details>
</Error> Any ideas? |
@jonparrott Wrote the snippet. |
It's probably fine, it's just that the bucket has to exist. |
@jonparrott in my test, I was/am using a bucket that exists. |
Weird. That error message indicates otherwise! |
@jonparrott haha I know! 😕 |
Can you try manually verifying it? |
@jonparrott yeah that's how I'm getting the error. I'm not just running the snippets. The storage snippets need some updating to work. bucket = client.bucket('my-bucket24356uytrew')
conditions = [
['starts-with', '$key', ''],
{'acl': 'public-read'}]
policy = bucket.generate_upload_policy(conditions)
# Generate an upload form using the form fields.
policy_fields = ''.join(
'<input type="hidden" name="{key}" value="{value}">'.format(
key=key, value=value)
for key, value in policy.items()
)
upload_form = (
'<form action="http://{bucket_name}.storage.googleapis.com"'
' method="post" enctype="multipart/form-data">'
'<input type="text" name="key" value="">'
'<input type="hidden" name="bucket" value="{bucket_name}">'
'<input type="hidden" name="acl" value="public-read">'
'<input name="file" type="file">'
'<input type="submit" value="Upload">'
'{policy_fields}'
'<form>').format(bucket_name=bucket.name, policy_fields=policy_fields)
print(upload_form) |
Hmm. I'm at a a bit of a loss. |
I was able to get the logging snippets running somewhat. instantiate_client : Instantiate client.
ERROR: ValueError('This library only supports credentials from google-auth-library-python. See https://google-cloud-python.readthedocs.io/en/latest/google-cloud-auth.html for help on authentication with this library.',)
client_list_entries : List entries via client.
ERROR: TypeError('Can not find message descriptor by type_url: type.googleapis.com/google.cloud.audit.AuditLog.',)
logger_usage : Logger usage.
metric_crud : Metric CRUD.
sink_storage : Sink log entries to storage.
sink_bigquery : Sink log entries to bigquery.
sink_pubsub : Sink log entries to pubsub.
logging_handler : None
setup_logging : None |
@daspecster can you file a separate bug about the storage policy document stuff and assign it to me? Thanks! |
@jonparrott sure thing! |
Ok, just a few PR's to merge and I think we're pretty much there. |
Ok all the PRs are merged. I'm not saying the docs are perfect but they should be a lot closer. I'm going to close this issue since all the outlined tasks are completed. |
🎉, thanks. |
…dPlatform/python-docs-samples#3172) * Update dependency grafeas to v0.4.0 * follow the field name changes Co-authored-by: Leah E. Cole <6719667+leahecole@users.noreply.github.com> Co-authored-by: Takashi Matsuo <tmatsuo@google.com>
Test all doc links and examples for...
/cc @lukesneeringer @omaray
The text was updated successfully, but these errors were encountered: