GeezerVison is showing github.com — AttributeError: 'ProtobufEntry' object has no attribute 'text_payload' · Issue #1807 · googleapis/google-cloud-python
AttributeError: 'ProtobufEntry' object has no attribute 'text_payload' #1807Labels api: loggingIssues related to the Cloud Logging API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. DescriptionReproducing this is blocked by #1806, but I wanted to make sure it gets recorded this popped up. Still on client.list_entries:
File "list_logs.py", line 45, in list_logs
format((timestamp, entry.text_payload, entry.struct_payload)))
AttributeError: 'ProtobufEntry' object has no attribute 'text_payload'Activitywaprin commented on May 18, 2016 ContributorAuthor More actions Actually if I remove the #1806 validation I reliably reproduce this. waprin commented on May 18, 2016 ContributorAuthor More actions I am now realizing that this is in my own code, however that was copied from the docs so maybe just a docs error. waprin commented on May 23, 2016 ContributorAuthor More actions @dhermes Still need to clean up the docs. Is the idea that now you will just reference payload directly for each LogEntry type? Also, the docs say its logger.delete_entries() when now its logger.delete(). Can make the PR if you'd like. tseaver commented on May 23, 2016 @waprin, can you show the example which is triggering the traceback?
Is the idea that now you will just reference payload directly for each LogEntry type?
Yes, each entry type (TextEntry, StructEntry, and ProtobufEntry) will have a payload attribute. For ProtobufEntry objects, you can use the parse_mesage method to get an actual protobuf: by default, it comes across the wire as a mapping.
Also, the docs say its logger.delete_entries() when now its logger.delete(). Can make the PR if you'd like.
Thanks, that would be great. waprin commented on May 23, 2016 ContributorAuthor More actions http://googlecloudplatform.github.io/gcloud-python/stable/logging-usage.html .
from gcloud import logging
>>> client = logging.Client()
>>> entries, token = client.list_entries() # API call
>>> for entry in entries:
... timestamp = entry.timestamp.isoformat()
... print('%sZ: %s | %s' %
... (timestamp, entry.text_payload, entry.struct_payload))
There are some other changes as well, I am writing the samples for python-docs-samples then I'll swing by and update it all. dhermes commented on May 25, 2016 waprin commented on Jun 3, 2016 ContributorAuthor More actions Still planning on fixing these docs, just waiting for your next release so I have all the working samples then I'll update the docs here. Reacted by Thomas Schultz dhermes commented on Jun 7, 2016 I can cut a release tomorrow. @tseaver Any reason not to? tseaver commented on Jun 7, 2016 dhermes commented on Jun 7, 2016 OK starting process now. I'll cc you on the release PR @waprin tseaver commented on Jun 15, 2016
MetadataMetadataapi: loggingIssues related to the Cloud Logging API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. DevelopmentNo branches or pull requestsIssue actions
|