def get_global_googleads_client(): global GOOGLEADS_CLIENT if GOOGLEADS_CLIENT: return GOOGLEADS_CLIENT else: setup.set_api_configs() GOOGLEADS_CLIENT = GoogleAdsClient.load_from_storage( CONFIG_PATH / 'google-ads.yaml') return GOOGLEADS_CLIENT
invitation.access_role = client.enums.AccessRoleEnum[access_role].value response = service.mutate_customer_user_access_invitation( customer_id=customer_id, operation=invitation_operation) print("Customer user access invitation was sent for " f"customer ID: '{customer_id}', " f"email address {email_address}, and " f"access role {access_role}. The invitation resource name is: " f"{response.result.resource_name}") # [END invite_user_with_access_role] if __name__ == "__main__": # GoogleAdsClient will read the google-ads.yaml configuration file in the # home directory if none is specified. googleads_client = GoogleAdsClient.load_from_storage(version="v8") parser = argparse.ArgumentParser(description=( "Sends an invitation email to a user to manage a customer " "account with a desired access role.")) # The following argument(s) should be provided to run the example. parser.add_argument( "-c", "--customer_id", type=str, required=True, help="The Google Ads customer ID.", ) parser.add_argument( "-e", "--email_address",
if __name__ == '__main__': parser = argparse.ArgumentParser( description='Check status of customer match list jobs in Google Ads.') parser.add_argument('--config_file', default=CONFIG_PATH, help='Configuration file for Google Ads API access.') parser.add_argument('--customer_id', required=True, help='The customer ID for which to add the user list.') parser.add_argument('--job_resource_name', required=True, help='Offline user data job resource name to check.') parser.add_argument('--user_list_resource_name', required=True, help='User list resource name.') args = parser.parse_args() google_ads_client = GoogleAdsClient.load_from_storage(args.config_file) try: check_job_status(google_ads_client, args.customer_id, args.job_resource_name, args.user_list_resource_name) except GoogleAdsException as ex: print(f'Request with ID "{ex.request_id}" failed with status ' f'"{ex.error.code().name}" and includes the following errors:') for single_error in ex.failure.errors: print(f'\tError with message "{single_error.message}".') if single_error.location: for field_path_element in single_error.location.field_path_elements: print(f'\t\tOn field: {field_path_element.field_name}')
parser = argparse.ArgumentParser( description="This analyzer will display the account info " "according to the input." ) # process argument(s) parser.add_argument( "-c", "--customer_id", type=str, required=False, help="The Google Ads customer ID.", ) args = parser.parse_args() try: googleads_client = GoogleAdsClient.load_from_storage() account_hierarchy_module(googleads_client, args.customer_id) get_users_module(googleads_client, args.customer_id) except GoogleAdsException as ex: print( f'Request with ID "{ex.request_id}" failed with status ' f'"{ex.error.code().name}" ' ) print(f"And includes the following errors:") for error in ex.failure.errors: print(f'\tError with message "{error.message}".') if error.location: for field_path_element in error.location.field_path_elements: print(f"\t\tOn field: {field_path_element.field_name}") sys.exit(1)