Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add add_campaign_draft.py code example #251

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

Merged
merged 12 commits into from
Mar 24, 2020

Conversation

xflesym
Copy link
Contributor

@xflesym xflesym commented Mar 24, 2020

add add_campaign_draft.py code example

@xflesym xflesym requested review from wihl and fiboknacky March 24, 2020 08:53
# See the License for the specific language governing permissions and
# limitations under the License.
"""This example adds a campaign draft for a campaign.
Make sure you specify a campaign that has a non-shared budget.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: leave a blank line between "This..." and "Make..."

import sys
from uuid import uuid4

import google.ads.google_ads.client
Copy link
Contributor

Choose a reason for hiding this comment

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

Replace by
from google.ads.google_ads.client import GoogleAdsClient



def main(client, customer_id, base_campaign_id):
campaign_service = client.get_service('CampaignService',version='v3')
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: space required between 'CampaignService', version='v3'

print(f'\t\tOn field: {field_path_element.field_name}')
sys.exit(1)

print(f'Created campaign draft: '
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: does not need an f-string since there is no substitution

sys.exit(1)

print(f'Created campaign draft: '
f'{campaign_draft_response.results[0].resource_name}.')
Copy link
Contributor

Choose a reason for hiding this comment

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

enclose resulting resource name in quotes, ie.
f'"{campaign_draft_response.results[0].resource_name}".')

Copy link
Member

@fiboknacky fiboknacky left a comment

Choose a reason for hiding this comment

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

Approve pending David's comment.

@xflesym
Copy link
Contributor Author

xflesym commented Mar 24, 2020

Addressed David's comments. PTAL. thx

@wihl wihl merged commit adf33d9 into googleads:master Mar 24, 2020
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