Skip to content

converted two old examples to use search_stream - #253

Merged
wihl merged 5 commits into
masterfrom
more-streaming-examples
Mar 26, 2020
Merged

converted two old examples to use search_stream#253
wihl merged 5 commits into
masterfrom
more-streaming-examples

Conversation

@wihl

@wihl wihl commented Mar 24, 2020

Copy link
Copy Markdown
Contributor

As part of doc update to streaming, moving over two old examples to streaming

@wihl
wihl requested review from BenRKarl and fiboknacky March 24, 2020 18:18
Comment thread examples/billing/get_billing_setup.py Outdated
f'payments_account_name "{payments_account_info.payments_account_name.value}", '
f'payments_profile_id {payments_account_info.payments_profile_id.value}, '
f'payments_profile_name "{payments_account_info.payments_profile_name.value}", '
f'secondary_payments_profile_id "{payments_account_info.secondary_payments_profile_id.value}".')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this is a little tough to read, would it be worth setting some of these values to variables above the print statement so that the printed string is a easier to parse visually?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used a shorter prefix variable name. Looking forward to getting rid of .value

@wihl wihl self-assigned this Mar 24, 2020
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# Copyright 2018 Google LLC
# Copyright 2020 Google LLC

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we don't change copy right for the existing examples.

Comment thread examples/billing/get_billing_setup.py Outdated
print(f'Billing setup with ID {billing_setup.id.value}, '
f'status "{billing_setup_status_enum.Name(billing_setup.status)}", '
f'payments_account "{billing_setup.payments_account.value}" '
f'payments_account_id "{pai.payments_account_id.value}", '

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ID doesn't need quotes. Same for secondary_payments_profile_id below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that if secondary_payments_profile_id is empty (as it is in my case), the result is just a blank space.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why we have this logic in PHP's. :)

@fiboknacky fiboknacky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small comment.

Comment on lines +50 to +53
if pai.secondary_payments_profile_id.value:
secondary_payments_profile_id = pai.secondary_payments_profile_id.value
else:
secondary_payments_profile_id = "None"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't this be just:

secondary_payments_profile_id = (pai.secondary_payments_profile_id.value 
                                 if pai.secondary_payments_profile_id.value
                                 else "None")

?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be, but I'm not a big fan of that syntax as it hides intentionality somewhat. Since the rest of this example does not use it, I didn't want to introduce it.

@wihl
wihl merged commit 7faba3c into master Mar 26, 2020
@BenRKarl
BenRKarl deleted the more-streaming-examples branch October 29, 2021 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants