text stringlengths 81 112k |
|---|
Sets the type of the WHERE clause as "contains any".
Args:
*values: The values to be used in the WHERE condition.
Returns:
The query builder that this WHERE builder links to.
def ContainsAny(self, *values):
"""Sets the type of the WHERE clause as "contains any".
Args:
*values: The ... |
Sets the type of the WHERE clause as "contains none".
Args:
*values: The values to be used in the WHERE condition.
Returns:
The query builder that this WHERE builder links to.
def ContainsNone(self, *values):
"""Sets the type of the WHERE clause as "contains none".
Args:
*values: T... |
Sets the type of the WHERE clause as "contains all".
Args:
*values: The values to be used in the WHERE condition.
Returns:
The query builder that this WHERE builder links to.
def ContainsAll(self, *values):
"""Sets the type of the WHERE clause as "contains all".
Args:
*values: The ... |
Creates a single-value condition with the provided value and operator.
def _CreateSingleValueCondition(self, value, operator):
"""Creates a single-value condition with the provided value and operator."""
if isinstance(value, str) or isinstance(value, unicode):
value = '"%s"' % value
return '%s %s %s'... |
Creates a condition with the provided list of values and operator.
def _CreateMultipleValuesCondition(self, values, operator):
"""Creates a condition with the provided list of values and operator."""
values = ['"%s"' % value if isinstance(value, str) or
isinstance(value, unicode) else str(value) ... |
Sets the LIMIT clause of the AWQL to the next page.
This method is meant to be used with HasNext(). When using DataService,
page is needed, as its paging mechanism is different from other services.
For details, see
https://developers.google.com/adwords/api/docs/guides/bid-landscapes#paging_through_resu... |
Checks if there is still a page left to query.
This method is meant to be used with NextPage(). When using DataService,
the paging mechanism is different from other services. For details, see
https://developers.google.com/adwords/api/docs/guides/bid-landscapes#paging_through_results.
Args:
page:... |
A page generator for this service query and the provided service.
This generates a page as a result from using the provided service's query()
method until there are no more results to fetch.
Args:
service: The service object for making a query using this service query.
Yields:
A resulting... |
Initialize application user.
Retrieve existing user credentials from datastore or add new user.
Returns:
AppUser instance of the application user.
def InitUser():
"""Initialize application user.
Retrieve existing user credentials from datastore or add new user.
Returns:
AppUser instance of the ap... |
Update the credentials associated with application user.
Args:
client_id: str Client Id retrieved from the developer's console.
client_secret: str Client Secret retrieved from the developer's console.
refresh_token: str Refresh token generated with the above client id/secret.
adwords_manager_cid: str... |
Creates a default partition.
Args:
client: an AdWordsClient instance.
ad_group_id: an integer ID for an ad group.
def CreateDefaultPartition(client, ad_group_id):
"""Creates a default partition.
Args:
client: an AdWordsClient instance.
ad_group_id: an integer ID for an ad group.
"""
ad_grou... |
Sanitizes a field value from a Value object to a CSV suitable format.
Args:
pql_value: dict a dictionary containing the data for a single field of an
entity.
Returns:
str a CSV writer friendly value formatted by Value.Type.
def ConvertValueForCsv(pql_value):
"""Sanitizes a field value ... |
Converts the PQL formatted response for a dateTime object.
Output conforms to ISO 8061 format, e.g. 'YYYY-MM-DDTHH:MM:SSz.'
Args:
date_time_value: dict The date time value from the PQL response.
Returns:
str: A string representation of the date time value uniform to
ReportService.
def ConvertD... |
Creates a user identifier from the specified type and value.
Args:
identifier_type: a str specifying the type of user identifier.
value: a str value of the identifier; to be hashed using SHA-256 if needed.
Returns:
A dict specifying a user identifier, with a value hashed using SHA-256 if
needed.... |
Retrieve the index of a given field in the api_error's fieldPathElements.
Args:
api_error: a dict containing a partialFailureError returned from the AdWords
API.
field: a str field for which this determines the index in the api_error's
fieldPathElements.
Returns:
An int index of the field ... |
Handle post request.
def post(self):
"""Handle post request."""
client_customer_id = self.request.get('clientCustomerId')
budget_id = self.request.get('budgetId')
if not client_customer_id or not budget_id:
self.redirect('/')
else:
self.redirect('/showBudget?clientCustomerId=%s&budgetId... |
Appends a Monkey Patch to the suds.mx.appender module.
This resolves an issue where empty objects are ignored and stripped from the
request output. More details can be found on the suds-jurko issue tracker:
https://goo.gl/uyYw0C
def _ApplySudsJurkoAppenderPatch(self):
"""Appends a Monkey Patch to the ... |
Appends a Monkey Patch to the suds.transport.http module.
This allows the suds library to decompress the SOAP body when compression is
enabled. For more details on SOAP Compression, see:
https://developers.google.com/adwords/api/docs/guides/bestpractices?hl=en#use_compression
def _ApplySudsJurkoSendPatch(... |
Overrides the ingress function for response logging.
Args:
envelope: An Element with the SOAP request data.
http_headers: A dict of the current http headers.
operation: The SoapOperation instance.
Returns:
A tuple of the envelope and headers.
def ingress(self, envelope, http_headers, ... |
Overrides the egress function ror request logging.
Args:
envelope: An Element with the SOAP request data.
http_headers: A dict of the current http headers.
operation: The SoapOperation instance.
binding_options: An options dict for the SOAP binding.
Returns:
A tuple of the envelo... |
Restrict a feed item to a geo target location.
Args:
client: An AdWordsClient instance.
feed_item: A FeedItem.
location_id: The Id of the location to restrict to.
def RestrictFeedItemToGeoTarget(client, feed_item, location_id):
"""Restrict a feed item to a geo target location.
Args:
client: An ... |
Adds a new Smart Shopping campaign.
Args:
client: an AdWordsClient instance.
budget_id: the str ID of the budget to be associated with the Shopping
campaign.
merchant_id: the str ID of the merchant account to be associated with the
Shopping campaign.
Returns:
A campaign ID.
def CreateS... |
Adds a new Smart Shopping ad group.
Args:
client: an AdWordsClient instance.
campaign_id: the str ID of a Smart Shopping campaign.
Returns:
An ad group ID.
def CreateSmartShoppingAdGroup(client, campaign_id):
"""Adds a new Smart Shopping ad group.
Args:
client: an AdWordsClient instance.
... |
Adds a new Smart Shopping ad.
Args:
client: an AdWordsClient instance.
ad_group_id: an integer ID for an ad group.
def CreateSmartShoppingAd(client, ad_group_id):
"""Adds a new Smart Shopping ad.
Args:
client: an AdWordsClient instance.
ad_group_id: an integer ID for an ad group.
"""
ad_gro... |
A simple convenience utility for adding months to a given start date.
This increments the months by adding the number of days in the current month
to the current month, for each month.
Args:
start_date: date The date months are being added to.
months: int The number of months to add.
Returns:
A d... |
Displays mean average cpc, position, clicks, and total cost for estimate.
Args:
message: str message to display for the given estimate.
min_estimate: sudsobject containing a minimum estimate from the
TrafficEstimatorService response.
max_estimate: sudsobject containing a maximum estimate from the
... |
Builds a client config dictionary used in the OAuth 2.0 flow.
def Build(self):
"""Builds a client config dictionary used in the OAuth 2.0 flow."""
if all((self.client_type, self.client_id, self.client_secret,
self.auth_uri, self.token_uri)):
client_config = {
self.client_type: {
... |
Format a SOAP DateTime object for printing.
Args:
value: The DateTime object to format.
Returns:
A string representing the value.
def FormatSOAPDateTime(value):
"""Format a SOAP DateTime object for printing.
Args:
value: The DateTime object to format.
Returns:
A string representing the va... |
Calculate forecast percentage stats.
Args:
matched: The number of matched impressions.
available: The number of available impressions.
possible: The optional number of possible impressions.
Returns:
The percentage of impressions that are available and possible.
def CalculateForecastStats(matched,... |
Creates a shopping campaign with the given budget and merchant IDs.
Args:
client: an AdWordsClient instance.
budget_id: the str ID of the budget to be associated with the shopping
campaign.
merchant_id: the str ID of the merchant account to be associated with the
shopping campaign.
Returns... |
Creates an AdGroup for the given shopping campaign ID.
Args:
client: an AdWordsClient instance.
campaign_id: the str ID of a shopping campaign.
Returns:
The created AdGroup as a sudsobject.
def CreateAdGroup(client, campaign_id):
"""Creates an AdGroup for the given shopping campaign ID.
Args:
... |
Creates a showcase add for the given AdGroup with the given images.
Args:
client: an AdWordsClient instance.
adgroup: a dict or suds object defining an AdGroup for a Shopping Campaign.
expanded_image_filepath: a str filepath to a .jpg file that will be used as
the Showcase Ad's expandedImage.
c... |
Uploads a .jpg image with the given filepath via the AdWords MediaService.
Args:
client: an AdWordsClient instance.
filepath: a str filepath to the .jpg file to be uploaded.
Returns:
The created Image as a sudsobject.
def UploadImage(client, filepath):
"""Uploads a .jpg image with the given filepat... |
Creates a ProductPartition tree for the given AdGroup ID.
Args:
client: an AdWordsClient instance.
adgroup_id: a str AdGroup ID.
Returns:
The ProductPartition tree as a sudsobject.
def CreateProductPartition(client, adgroup_id):
"""Creates a ProductPartition tree for the given AdGroup ID.
Args:
... |
Creates a subdivision node.
Args:
parent: The node that should be this node's parent.
value: The value being partitioned on.
Returns:
A new subdivision node.
def CreateSubdivision(self, parent=None, value=None):
"""Creates a subdivision node.
Args:
parent: The node that should... |
Creates a unit node.
Args:
parent: The node that should be this node's parent.
value: The value being partitioned on.
bid_amount: The amount to bid for matching products, in micros.
Returns:
A new unit node.
def CreateUnit(self, parent=None, value=None, bid_amount=None):
"""Creates... |
Retrieve and display the access and refresh token.
def main(client_id, client_secret, scopes):
"""Retrieve and display the access and refresh token."""
client_config = ClientConfigBuilder(
client_type=ClientConfigBuilder.CLIENT_TYPE_WEB, client_id=client_id,
client_secret=client_secret)
flow = Insta... |
Handle post request.
def post(self):
"""Handle post request."""
client_customer_id = self.request.get('clientCustomerId')
campaign_id = self.request.get('campaignId')
if not client_customer_id or not campaign_id:
self.redirect('/')
else:
self.redirect('/showAdGroups?clientCustomerId=%s&... |
Handle get request.
def get(self):
"""Handle get request."""
template_values = {
'back_url': '/',
'back_msg': 'View Accounts',
'logout_url': users.create_logout_url('/'),
'user_nickname': users.get_current_user().nickname()
}
try:
try:
app_user = InitUser()... |
Creates the budget.
Args:
client: an AdWordsClient instance.
Returns:
a suds.sudsobject.Object representation of the created budget.
def _CreateBudget(client):
"""Creates the budget.
Args:
client: an AdWordsClient instance.
Returns:
a suds.sudsobject.Object representation of the created b... |
Creates the campaign.
Args:
client: an AdWordsClient instance.
budget: a suds.sudsobject.Object representation of a created budget.
Returns:
An integer campaign ID.
def _CreateCampaign(client, budget):
"""Creates the campaign.
Args:
client: an AdWordsClient instance.
budget: a suds.sudso... |
Creates an ad group.
Args:
client: an AdWordsClient instance.
campaign_id: an integer campaign ID.
Returns:
An integer ad group ID.
def _CreateAdGroup(client, campaign_id):
"""Creates an ad group.
Args:
client: an AdWordsClient instance.
campaign_id: an integer campaign ID.
Returns:
... |
Creates the expanded Dynamic Search Ad.
Args:
client: an AdwordsClient instance.
ad_group_id: an integer ID of the ad group in which the DSA is added.
def _CreateExpandedDSA(client, ad_group_id):
"""Creates the expanded Dynamic Search Ad.
Args:
client: an AdwordsClient instance.
ad_group_id: an... |
Adds a web page criterion to target Dynamic Search Ads.
Args:
client: an AdWordsClient instance.
ad_group_id: an integer ID of the ad group the criteria is being added to.
def _AddWebPageCriteria(client, ad_group_id):
"""Adds a web page criterion to target Dynamic Search Ads.
Args:
client: an AdWor... |
Uploads the image from the specified url.
Args:
client: An AdWordsClient instance.
url: The image URL.
Returns:
The ID of the uploaded image.
def UploadImageAsset(client, url):
"""Uploads the image from the specified url.
Args:
client: An AdWordsClient instance.
url: The image URL.
Re... |
Generates a library signature suitable for a user agent field.
Args:
short_name: The short, product-specific string name for the library.
Returns:
A library signature string to append to user-supplied user-agent value.
def GenerateLibSig(short_name):
"""Generates a library signature suitable for a user ... |
Loads the data necessary for instantiating a client from file storage.
In addition to the required_client_values argument, the yaml file must supply
the keys used to create OAuth2 credentials. It may also optionally set proxy
configurations.
Args:
yaml_doc: the yaml document whose keys should be used.
... |
Loads the data necessary for instantiating a client from file storage.
In addition to the required_client_values argument, the yaml file must supply
the keys used to create OAuth2 credentials. It may also optionally set proxy
configurations.
Args:
path: A path string to the yaml document whose keys should... |
Generates an GoogleOAuth2Client subclass using the given product_data.
Args:
product_yaml_key: a string key identifying the product being configured.
product_data: a dict containing the configurations for a given product.
proxy_config: a ProxyConfig instance.
Returns:
An instantiated GoogleOAuth2C... |
Returns an initialized ProxyConfig using the given proxy_config_data.
Args:
product_yaml_key: a string indicating the client being loaded.
proxy_config_data: a dict containing the contents of proxy_config from the
YAML file.
Returns:
If there is a proxy to configure in proxy_config, this will re... |
Packs SOAP input into the format we want for suds.
The main goal here is to pack dictionaries with an 'xsi_type' key into
objects. This allows dictionary syntax to be used even with complex types
extending other complex types. The contents of dictionaries and lists/tuples
are recursively packed. Mutable types ... |
Recurses over a nested structure to look for changes in Suds objects.
Args:
obj: A parameter for a SOAP request field which is to be inspected and
will be packed for Suds if an xsi_type is specified, otherwise will be
left unaltered.
factory: The suds.client.Factory object which can create in... |
Decorator that registers a class with the given utility name.
This will only register the utilities being used if the UtilityRegistry is
enabled. Note that only the utility class's public methods will cause the
utility name to be added to the registry.
Args:
utility_name: A str specifying the utility name... |
Extract logging fields from the request's suds.sax.element.Element.
Args:
document: A suds.sax.element.Element instance containing the API request.
Returns:
A dict mapping logging field names to their corresponding value.
def _ExtractRequestSummaryFields(document):
"""Extract logging fields from the re... |
Extract logging fields from the response's suds.sax.document.Document.
Args:
document: A suds.sax.document.Document instance containing the parsed
API response for a given API request.
Returns:
A dict mapping logging field names to their corresponding value.
def _ExtractResponseSummaryFields(docume... |
Creates a ssl.SSLContext with the given settings.
Args:
cafile: A str identifying the resolved path to the cafile. If not set,
this will use the system default cafile.
disable_ssl_certificate_validation: A boolean indicating whether
certificate verification is disabled. For security pur... |
Retrieve the appropriate urllib2 handlers for the given configuration.
Returns:
A list of urllib2.BaseHandler subclasses to be used when making calls
with proxy.
def GetHandlers(self):
"""Retrieve the appropriate urllib2 handlers for the given configuration.
Returns:
A list of urllib2.B... |
Get a collection of urllib2 handlers to be installed in the opener.
Returns:
A list of handlers to be installed to the OpenerDirector used by suds.
def u2handlers(self):
"""Get a collection of urllib2 handlers to be installed in the opener.
Returns:
A list of handlers to be installed to the O... |
Return an XML string representing a SOAP complex type.
Args:
type_name: The name of the type with namespace prefix if necessary.
value: A python dictionary to hydrate the type instance with.
Returns:
A string containing the SOAP XML for the type.
def GetSoapXMLForComplexType(self, type_name... |
Return an XML string representing a SOAP complex type.
Args:
type_name: The name of the type with namespace prefix if necessary.
value: A python dictionary to hydrate the type instance with.
Returns:
A string containing the SOAP XML for the type.
def GetSoapXMLForComplexType(self, type_name... |
Get the raw SOAP XML for a request.
Args:
method: The method name.
*args: A list of arguments to be passed to the method.
Returns:
An element containing the raw XML that would be sent as the request.
def GetRequestXML(self, method, *args):
"""Get the raw SOAP XML for a request.
Arg... |
Set the headers for the underlying client.
Args:
soap_headers: A SOAP element for the SOAP headers.
http_headers: A dictionary for the http headers.
def SetHeaders(self, soap_headers, http_headers):
"""Set the headers for the underlying client.
Args:
soap_headers: A SOAP element for the... |
Determine if the wsdl contains a method.
Args:
method_name: The name of the method to search.
Returns:
True if the method is in the WSDL, otherwise False.
def _WsdlHasMethod(self, method_name):
"""Determine if the wsdl contains a method.
Args:
method_name: The name of the method to... |
Create a method wrapping an invocation to the SOAP service.
Args:
method_name: A string identifying the name of the SOAP method to call.
Returns:
A callable that can be used to make the desired SOAP request.
def _CreateMethod(self, method_name):
"""Create a method wrapping an invocation to th... |
Overriding the egress function to set our headers.
Args:
envelope: An Element with the SOAP request data.
http_headers: A dict of the current http headers.
operation: The SoapOperation instance.
binding_options: An options dict for the SOAP binding.
Returns:
A tuple of the envelo... |
Get the raw SOAP XML for a request.
Args:
method: The method name.
*args: A list of arguments to be passed to the method.
Returns:
An element containing the raw XML that would be sent as the request.
def GetRequestXML(self, method, *args):
"""Get the raw SOAP XML for a request.
Arg... |
Determine if a method is in the wsdl.
Args:
method_name: The name of the method.
Returns:
True if the method is in the wsdl, otherwise False.
def _WsdlHasMethod(self, method_name):
"""Determine if a method is in the wsdl.
Args:
method_name: The name of the method.
Returns:
... |
Return a string with the namespace of the service binding in the WSDL.
def _GetBindingNamespace(self):
"""Return a string with the namespace of the service binding in the WSDL."""
return (list(self.zeep_client.wsdl.bindings.itervalues())[0]
.port_name.namespace) |
Properly pack input dictionaries for zeep.
Pack a list of python dictionaries into XML objects. Dictionaries which
contain an 'xsi_type' entry are converted into that type instead of the
argument default. This allows creation of complex objects which include
inherited types.
Args:
method_nam... |
An imperfect but decent method for determining if a string is base64.
Args:
s: A string with the data to test.
Returns:
True if s is base64, else False.
def _IsBase64(cls, s):
"""An imperfect but decent method for determining if a string is base64.
Args:
s: A string with the data t... |
Recursive helper for PackArguments.
Args:
elem: The element type we are creating.
data: The data to instantiate it with.
set_type_attrs: A boolean indicating whether or not attributes that end
in .Type should be set. This is only necessary for batch job service.
Returns:
An ins... |
Searches all namespaces for a type by name.
Args:
type_localname: The name of the type.
Returns:
A fully qualified SOAP type with the specified name.
Raises:
A zeep.exceptions.LookupError if the type cannot be found in any
namespace.
def _DiscoverElementTypeFromLocalname(self, ... |
Initialize a SOAP element with specific data.
Args:
elem_type: The type of the element to create.
type_is_override: A boolean specifying if the type is being overridden.
data: The data to hydrate the type with.
set_type_attrs: A boolean indicating whether or not attributes that end
... |
Returns a dict with SOAP headers in the right format for zeep.
def _GetZeepFormattedSOAPHeaders(self):
"""Returns a dict with SOAP headers in the right format for zeep."""
headers = self._header_handler.GetSOAPHeaders(self.CreateSoapElementForType)
soap_headers = {'RequestHeader': headers}
return soap_... |
Create a method wrapping an invocation to the SOAP service.
Args:
method_name: A string identifying the name of the SOAP method to call.
Returns:
A callable that can be used to make the desired SOAP request.
def _CreateMethod(self, method_name):
"""Create a method wrapping an invocation to th... |
Runs the example.
def main(client, adgroup_id):
"""Runs the example."""
adgroup_criterion_service = client.GetService(
'AdGroupCriterionService', version='v201809')
helper = ProductPartitionHelper(adgroup_id)
# The most trivial partition tree has only a unit node as the root, e.g.:
# helper.CreateUni... |
Recursively display a node and each of its children.
Args:
node: The node we're displaying the children of.
children: Children of the parent node.
level: How deep in the tree we are.
def DisplayTree(node, children, level=0):
"""Recursively display a node and each of its children.
Args:
node: Th... |
Download all ad units.
Args:
inventory_service: An instance of the InventoryService.
Returns:
A list containing all ad units.
def get_all_ad_units(inventory_service):
"""Download all ad units.
Args:
inventory_service: An instance of the InventoryService.
Returns:
A list containing all ad ... |
Display the ad units as a tree.
Args:
root_ad_unit: The root ad unit to begin from.
all_ad_units: A list containing all ad units.
def display_hierarchy(root_ad_unit, all_ad_units):
"""Display the ad units as a tree.
Args:
root_ad_unit: The root ad unit to begin from.
all_ad_units: A list contai... |
Recursive helper for displaying the hierarchy.
Args:
root: The current root ad unit.
parent_id_to_children: The overall map of parent ids to children.
depth: The current depth.
def display_hierarchy_helper(root, parent_id_to_children, depth):
"""Recursive helper for displaying the hierarchy.
Args:
... |
Create a campaign group.
Args:
client: an AdWordsClient instance.
Returns:
The integer ID of the created campaign group.
def _CreateCampaignGroup(client):
"""Create a campaign group.
Args:
client: an AdWordsClient instance.
Returns:
The integer ID of the created campaign group.
"""
# ... |
Adds multiple campaigns to a campaign group.
Args:
client: an AdWordsClient instance.
campaign_group_id: an integer ID for the campaign group.
campaign_ids: a list of integer IDs for campaigns.
def _AddCampaignsToGroup(client, campaign_group_id, campaign_ids):
"""Adds multiple campaigns to a campaign ... |
Creates a performance target for the campaign group.
Args:
client: an AdWordsClient instance.
campaign_group_id: an integer ID for the campaign group.
def _CreatePerformanceTarget(client, campaign_group_id):
"""Creates a performance target for the campaign group.
Args:
client: an AdWordsClient inst... |
Creates a service client for the given service.
Args:
service_name: A string identifying which Ad Manager service to create a
service client for.
[optional]
version: A string identifying the Ad Manager version to connect to. This
defaults to what is currently the latest versio... |
Creates a downloader for Ad Manager reports and PQL result sets.
This is a convenience method. It is functionally identical to calling
DataDownloader(ad_manager_client, version, server)
Args:
[optional]
version: A string identifying the Ad Manager version to connect to.
This defaults... |
Returns the SOAP headers required for request authorization.
Args:
create_method: The SOAP library specific method used to instantiate SOAP
objects.
Returns:
A SOAP object containing the headers.
def GetSOAPHeaders(self, create_method):
"""Returns the SOAP headers required for request a... |
Pack the given object using Ad Manager-specific logic.
Args:
obj: an object to be packed for SOAP using Ad Manager-specific logic, if
applicable.
version: the version of the current API, e.g. 'v201811'
Returns:
The given object packed with Ad Manager-specific logic for SOAP,
... |
Returns dicts formatted for Ad Manager SOAP based on date/datetime.
Args:
value: A date or datetime object to be converted.
version: the version of the current API, e.g. 'v201811'
Returns:
The value object correctly represented for Ad Manager SOAP.
def AdManagerDateTimePacker(cls, value, ve... |
Converts a dict of python types into a list of PQL types.
Args:
d: A dictionary of variable names to python types.
version: A string identifying the Ad Manager version the values object
is compatible with. This defaults to what is currently the latest
version. This will be updated i... |
Converts a single python value to its PQL representation.
Args:
value: A python value.
version: A string identifying the Ad Manager version the value object
is compatible with. This defaults to what is currently the latest
version. This will be updated in future releases to point to... |
Lazily initializes a report service client.
def _GetReportService(self):
"""Lazily initializes a report service client."""
if not self._report_service:
self._report_service = self._ad_manager_client.GetService(
'ReportService', self._version, self._server)
return self._report_service |
Lazily initializes a PQL service client.
def _GetPqlService(self):
"""Lazily initializes a PQL service client."""
if not self._pql_service:
self._pql_service = self._ad_manager_client.GetService(
'PublisherQueryLanguageService', self._version, self._server)
return self._pql_service |
Runs a report, then waits (blocks) for the report to finish generating.
Args:
report_job: The report job to wait for. This may be a dictionary or an
instance of the SOAP ReportJob class.
Returns:
The completed report job's ID as a string.
Raises:
An AdManagerReportError if the... |
Downloads report data and writes it to a file.
The report job must be completed before calling this function.
Args:
report_job_id: The ID of the report job to wait for, as a string.
export_format: The export format for the report file, as a string.
outfile: A writeable, file-like object to w... |
Downloads the results of a PQL query to a list.
Args:
pql_query: str a statement filter to apply (the query should not include
the limit or the offset)
[optional]
values: A dict of python objects or a list of raw SOAP values to bind
to the pql_query.
Returns:
... |
Downloads the results of a PQL query to CSV.
Args:
pql_query: str a statement filter to apply (the query should not include
the limit or the offset)
file_handle: file the file object to write to.
[optional]
values: A dict of python objects or a list of raw SOAP values to bi... |
Sanitizes a field value from a Value object to a CSV suitable format.
Args:
pql_value: dict a dictionary containing the data for a single field of an
entity.
Returns:
str a CSV writer friendly value formatted by Value.Type.
def _ConvertValueForCsv(self, pql_value):
"""Sanitiz... |
Pages through a pql_query and performs an action (output_function).
Args:
pql_query: str a statement filter to apply (the query should not include
the limit or the offset)
output_function: the function to call to output the results (csv or in
memory)
values... |
Converts the PQL formatted response for a dateTime object.
Output conforms to ISO 8061 format, e.g. 'YYYY-MM-DDTHH:MM:SSz.'
Args:
date_time_value: dict The date time value from the PQL response.
Returns:
str: A string representation of the date time value uniform to
ReportService.
... |
Handle post request.
def post(self):
"""Handle post request."""
template_values = {
'back_url': '/showCredentials',
'back_msg': 'View Credentials',
'logout_url': users.create_logout_url('/'),
'user_nickname': users.get_current_user().nickname()
}
try:
UpdateUserCre... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.