text
stringlengths
81
112k
Add a new BatchJob to upload operations to. Args: client: an instantiated AdWordsClient used to retrieve the BatchJob. Returns: The new BatchJob created by the request. def AddBatchJob(client): """Add a new BatchJob to upload operations to. Args: client: an instantiated AdWordsClient used to ret...
Builds the operations adding a Keyword Criterion to each AdGroup. Args: adgroup_id: an integer identifying an AdGroup to associate the keywords with. Returns: a list containing the operations that will create a new Keyword Criterion associated with each provided AdGroup. def BuildAdGroupCriteri...
Cancels the given BatchJob. Args: client: an instantiated AdWordsClient used to cancel the BatchJob. batch_job: a BatchJob to be canceled. max_poll_attempts: an int defining the number of times the BatchJob will be checked to determine whether it has been canceled. def CancelBatchJob(client, batch...
Retrieves the BatchJob with the given id. Args: client: an instantiated AdWordsClient used to retrieve the BatchJob. batch_job_id: a long identifying the BatchJob to be retrieved. Returns: The BatchJob associated with the given id. def GetBatchJob(client, batch_job_id): """Retrieves the BatchJob wit...
Retrieves the downloadUrl when the BatchJob is complete. Args: client: an instantiated AdWordsClient used to poll the BatchJob. batch_job_id: a long identifying the BatchJob to be polled. max_poll_attempts: an int defining the number of times the BatchJob will be checked to determine whether it has...
Prints the BatchJobService response. Args: batch_job_helper: a BatchJobHelper instance. response_xml: a string containing a response from the BatchJobService. def PrintResponse(batch_job_helper, response_xml): """Prints the BatchJobService response. Args: batch_job_helper: a BatchJobHelper instance...
Create a new ad group. Args: client_customer_id: str Client Customer Id used to create the AdGroup. campaign_id: str Id of the campaign to use. name: str Name to assign to the AdGroup. status: str Status to assign to the AdGroup when it is created. def AddAdGroup(self, client_customer_id, ...
Create a new Budget with the given microAmount. Args: client_customer_id: str Client Customer Id used to create Budget. micro_amount: str The budget represented in micros. Returns: str BudgetId of the newly created Budget. def AddBudget(self, client_customer_id, micro_amount): """Create...
Add a Campaign to the client account. Args: client_customer_id: str Client Customer Id to use when creating Campaign. campaign_name: str Name of the campaign to be added. ad_channel_type: str Primary serving target the campaign's ads. budget: str a budget amount (in micros) to use. def Add...
Return the client accounts associated with the user's manager account. Returns: list List of ManagedCustomer data objects. def GetAccounts(self): """Return the client accounts associated with the user's manager account. Returns: list List of ManagedCustomer data objects. """ selector ...
Retrieves all AdGroups for the given campaign that haven't been removed. Args: client_customer_id: str Client Customer Id being used in API request. campaign_id: str id of the campaign for which to fetch ad groups. Returns: list List of AdGroup data objects. def GetAdGroups(self, client_cus...
Return a Budget with the associated budgetId. Args: client_customer_id: str Client Customer Id to which the budget belongs. budget_id: str id of the budget we want to examine. Returns: Budget A Budget data object. def GetBudget(self, client_customer_id, budget_id): """Return a Budget wi...
Returns a client account's Campaigns that haven't been removed. Args: client_customer_id: str Client Customer Id used to retrieve Campaigns. Returns: list List of Campaign data objects. def GetCampaigns(self, client_customer_id): """Returns a client account's Campaigns that haven't been remov...
Update a Budget with the given budgetId. Args: client_customer_id: str Client Customer Id used to update Budget. budget_id: str Id of the budget to be updated. micro_amount: str New value for the microAmount field. delivery_method: str New value for the deliveryMethod field. def UpdateBudg...
Creates the extension setting for a list of Feed Items. Args: client: an AdWordsClient instance. feed_items: the list of all Feed Items. campaign_feed: the original Campaign Feed. feed_item_ids: the Ids of the feed items for which extension settings should be created. platform_restriction...
Creates a Sitelink Feed Item. Args: feed_items: a list of all Feed Items. feed_item_id: the Id of a specific Feed Item for which a Sitelink Feed Item should be created. Returns: The new Sitelink Feed Item. def CreateSitelinkFeedItem(feed_items, feed_item_id): """Creates a Sitelink Feed Item...
Deletes a campaign feed. Args: client: an AdWordsClient instance. campaign_feed: the campaign feed to delete. def DeleteCampaignFeed(client, campaign_feed): """Deletes a campaign feed. Args: client: an AdWordsClient instance. campaign_feed: the campaign feed to delete. """ campaign_feed_ser...
Deletes the old feed items for which extension settings have been created. Args: client: an AdWordsClient instance. feed_item_ids: a list of Feed Item Ids. feed: the Feed containing the given Feed Item Ids. def DeleteOldFeedItems(client, feed_item_ids, feed): """Deletes the old feed items for which ex...
Get a list of Feed Item Ids used by a campaign via a given Campaign Feed. Args: client: an AdWordsClient instance. feed: a Campaign Feed. placeholder_type: the Placeholder Type. Returns: A list of Feed Item Ids. def GetCampaignFeeds(client, feed, placeholder_type): """Get a list of Feed Item Id...
Returns a list of all enabled Feeds. Args: client: an AdWordsClient instance. Returns: A list containing all enabled Feeds. def GetFeeds(client): """Returns a list of all enabled Feeds. Args: client: an AdWordsClient instance. Returns: A list containing all enabled Feeds. """ feed_ser...
Returns the Feed Items for a given Feed. Args: client: an AdWordsClient instance. feed: the Feed we are retrieving Feed Items from. Returns: The Feed Items associated with the given Feed. def GetFeedItems(client, feed): """Returns the Feed Items for a given Feed. Args: client: an AdWordsClie...
Gets the Feed Item Ids used by a campaign through a given Campaign Feed. Args: campaign_feed: the Campaign Feed we are retrieving Feed Item Ids from. Returns: A list of Feed Item IDs. def GetFeedItemIdsForCampaign(campaign_feed): """Gets the Feed Item Ids used by a campaign through a given Campaign Fee...
Gets the Feed Mapping for a given Feed. Args: client: an AdWordsClient instance. feed: the Feed we are retrieving the Feed Mapping for. placeholder_type: the Placeholder Type we are looking for. Returns: A dictionary containing the Feed Mapping. def GetFeedMapping(client, feed, placeholder_type): ...
Get the Platform Restrictions for a given Campaign Feed. Args: campaign_feed: the Campaign Feed we are retrieving Platform Restrictons for. Returns: The Platform Restrictions for the given feed. def GetPlatformRestrictions(campaign_feed): """Get the Platform Restrictions for a given Campaign Feed. A...
Gets the sitelinks from a feed. Args: client: an AdWordsClient instance. feed: the feed used to retrieve sitelinks. Returns: A dictionary mapping the feed item ID to SiteLinkFromFeed. def GetSitelinksFromFeed(client, feed): """Gets the sitelinks from a feed. Args: client: an AdWordsClient in...
Gets the version from googleads/common.py. We can't import this directly because new users would get ImportErrors on our third party dependencies. Returns: The version of the library. def GetVersion(): """Gets the version from googleads/common.py. We can't import this directly because new users would ...
Builds the operations adding a Keyword Criterion to each AdGroup. Args: adgroup_operations: a list containing the operations that will add AdGroups. number_of_keywords: an int defining the number of Keywords to be created. Returns: a list containing the operations that will create a new Keyword Criter...
Builds the operations adding desired number of AdGroups to given Campaigns. Note: When the AdGroups are created, they will have a different Id than those generated here as a temporary Id. This is just used to identify them in the BatchJobService. Args: batch_job_helper: a BatchJobHelper instance. camp...
Builds the operations needed to create a new Campaign. Note: When the Campaigns are created, they will have a different Id than those generated here as a temporary Id. This is just used to identify them in the BatchJobService. Args: batch_job_helper: a BatchJobHelper instance. budget_operations: a lis...
Creates an image and uploads it to the server. Args: media_service: a SudsServiceProxy instance for AdWords's MediaService. opener: an OpenerDirector instance. url: a str URL used to load image data. Returns: The image that was successfully uploaded. def _CreateImage(media_service, opener, url): ...
Creates settings for dynamic display ad. Args: media_service: a SudsServiceProxy instance for AdWords's MediaService. opener: an OpenerDirector instance. Returns: The dynamic display ad settings. def _CreateDynamicDisplayAdSettings(media_service, opener): """Creates settings for dynamic display ad....
Creates a budget and returns its budgetId. Args: client: An AdWordsClient instance. Returns: An int budgetId for the created Budget. def CreateBudget(client): """Creates a budget and returns its budgetId. Args: client: An AdWordsClient instance. Returns: An int budgetId for the created Bu...
Sets targeting criteria for the given campaign. Args: client: An AdWordsClient instance. campaign: A suds object representing the campaign we wish to attach targeting criteria. def SetCampaignTargetingCriteria(client, campaign): """Sets targeting criteria for the given campaign. Args: client:...
Displays an account tree. Args: account: dict The account to display. accounts: dict Map from customerId to account. links: dict Map from customerId to child links. depth: int Depth of the current account in the tree. def DisplayAccountTree(account, accounts, links, depth=0): """Displays an accoun...
Handle get request. def get(self): """Handle get request.""" try: app_user = InitUser() if (app_user.client_id and app_user.client_secret and app_user.adwords_manager_cid and app_user.developer_token and app_user.refresh_token): self.redirect('/showAccounts') else...
Helper function to generate a single row of a price table. Args: header: A str containing the header text of this row. description: A str description of this row in the price table. final_url: A str containing the final URL after all cross domain redirects. price_in_micros: An int indicating the pric...
Creates a bidding strategy object. Args: client: AdWordsClient the client to run the example with. Returns: dict An object representing a bidding strategy. def CreateBiddingStrategy(client): """Creates a bidding strategy object. Args: client: AdWordsClient the client to run the example with. ...
Creates an explicit budget to be used only to create the Campaign. Args: client: AdWordsClient the client to run the example with. Returns: dict An object representing a shared budget. def CreateSharedBudget(client): """Creates an explicit budget to be used only to create the Campaign. Args: cli...
Create a Campaign with a Shared Bidding Strategy. Args: client: AdWordsClient the client to run the example with. bidding_strategy_id: string the bidding strategy ID to use. budget_id: string the shared budget ID to use. Returns: dict An object representing a campaign. def CreateCampaignWithBiddi...
Helper function used by ReportWorker to download customer report. Note that multiprocessing differs between Windows / Unix environments. A Process or its subclasses in Windows must be serializable with pickle, but that is not possible for AdWordsClient or ReportDownloader. This top-level function is used as a ...
Retrieves all CustomerIds in the account hierarchy. Note that your configuration file must specify a client_customer_id belonging to an AdWords manager account. Args: client: an AdWordsClient instance. Raises: Exception: if no CustomerIds could be found. Returns: A Queue instance containing all ...
Handle get request. def get(self): """Handle get request.""" client_customer_id = self.request.get('clientCustomerId') template_values = { 'back_url': '/showAccounts', 'back_msg': 'View Accounts.', 'ccid': client_customer_id, 'logout_url': users.create_logout_url('/'), ...
Handle post request. def post(self): """Handle post request.""" client_customer_id = self.request.get('clientCustomerId') if not client_customer_id: self.redirect('/') else: self.redirect('/showCampaigns?clientCustomerId=%s' % client_customer_id)
Creates a new Display Network campaign. Args: client: an AdWordsClient instance. merchant_id: a int merchant center ID. budget_id: a int budget ID. Returns: The campaign that was successfully created. def CreateCampaign(client, merchant_id, budget_id): """Creates a new Display Network campaign....
Creates a dynamic remarketing campaign. Args: client: an AdWordsClient instance. campaign_id: an int campaign ID. Returns: The ad group that was successfully created. def CreateAdGroup(client, campaign_id): """Creates a dynamic remarketing campaign. Args: client: an AdWordsClient instance. ...
Creates a ResponsiveDisplayAd. Args: client: an AdWordsClient instance. opener: an OpenerDirector instance. ad_group_id: an int ad group ID. Returns: The ad group ad that was successfully created. def CreateAd(client, opener, ad_group_id): """Creates a ResponsiveDisplayAd. Args: client: ...
Links the provided ad group and user list. Args: client: an AdWordsClient instance. ad_group_id: an int ad group ID. user_list_id: an int user list ID. Returns: The ad group criterion that was successfully created. def AttachUserList(client, ad_group_id, user_list_id): """Links the provided ad ...
Creates dynamic display ad settings. Args: client: an AdWordsClient instance. opener: an OpenerDirector instance. Returns: A dict containing the dynamic display ad settings. def CreateDynamicDisplayAdSettings(client, opener): """Creates dynamic display ad settings. Args: client: an AdWordsCl...
Retrieves the scope for the given API name. Args: api_name: A string identifying the name of the API we want to retrieve a scope for. Returns: A string that is the scope for the given API name. Raises: GoogleAdsValueError: If the given api_name is invalid; accepted values are "adwor...
Creates an OAuth2 HTTP header. The OAuth2 credentials will be refreshed as necessary. In the event that the credentials fail to refresh, a message is logged but no exception is raised. Returns: A dictionary containing one entry: the OAuth2 Bearer header under the 'Authorization' key. ...
Creates an OAuth2 HTTP header. The OAuth2 credentials will be refreshed as necessary. In the event that the credentials fail to refresh, a message is logged but no exception is raised. Returns: A dictionary containing one entry: the OAuth2 Bearer header under the 'Authorization' key. ...
Uses the Refresh Token to retrieve and set a new Access Token. Raises: google.auth.exceptions.RefreshError: If the refresh fails. def Refresh(self): """Uses the Refresh Token to retrieve and set a new Access Token. Raises: google.auth.exceptions.RefreshError: If the refresh fails. """ ...
Creates the feed for DSA page URLs. Args: client: an AdWordsClient instance. Returns: A _DSAFeedDetails instance containing details about the created feed. def _CreateFeed(client): """Creates the feed for DSA page URLs. Args: client: an AdWordsClient instance. Returns: A _DSAFeedDetails i...
Creates the feed mapping for DSA page feeds. Args: client: an AdWordsClient instance. feed_details: a _DSAFeedDetails instance. def _CreateFeedMapping(client, feed_details): """Creates the feed mapping for DSA page feeds. Args: client: an AdWordsClient instance. feed_details: a _DSAFeedDetails ...
Creates the page URLs in the DSA page feed. Args: client: an AdWordsClient instance. feed_details: a _DSAFeedDetails instance. label_name: a str containing the page feed URL label. def _CreateFeedItems(client, feed_details, label_name): """Creates the page URLs in the DSA page feed. Args: clien...
Updates the campaign DSA setting to DSA pagefeeds. Args: client: an AdWordsClient instance. campaign_id: a str Campaign ID. feed_id: a str page Feed ID. Raises: ValueError: If the given campaign is found not to be a dynamic search ad campaign. def _UpdateCampaignDSASetting(client, campaign_id...
Set custom targeting for the page feed URLs based on a list of labels. Args: client: an AdWordsClient instance. ad_group_id: a str AdGroup ID. label_name: a str label name. Returns: A suds.sudsobject.Object representing the newly created webpage criterion. def _AddDSATargeting(client, ad_group_id...
returns a value calculated from bits :param length: length of signal in bits :param is_float: value is float :param bits: value as bits (array/iterable) :param is_signed: value is signed :return: def unpack_bitstring(length, is_float, is_signed, bits): # type: (int, bool, bool, typing.Any) -> t...
returns a value in bits :param length: length of signal in bits :param is_float: value is float :param value: value to encode :param signed: value is signed :return: def pack_bitstring(length, is_float, value, signed): """ returns a value in bits :param length: length of signal in bits ...
Set Definition default value. :param default: default value; number, str or quoted str ("value") def set_default(self, default): # type: (typing.Any) -> None """Set Definition default value. :param default: default value; number, str or quoted str ("value") """ if default is ...
Get signal arxml-type and size based on the Signal properties. def get_base_type_of_signal(signal): # type: (canmatrix.Signal) -> typing.Tuple[str, int] """Get signal arxml-type and size based on the Signal properties.""" if signal.is_float: if signal.size > 32: create_type = "double" ...
Parse the xml tree into ArTree objects. def fill_tree_from_xml(tag, ar_tree, namespace): # type: (_Element, ArTree, str) -> None """Parse the xml tree into ArTree objects.""" for child in tag: # type: _Element name_elem = child.find('./' + namespace + 'SHORT-NAME') # long_name = child.find...
Get path in translation-dictionary. def ar_path_to_x_path(ar_path, dest_element=None): # type: (str, typing.Optional[str]) -> str """Get path in translation-dictionary.""" ar_path_elements = ar_path.strip('/').split('/') xpath = "." for element in ar_path_elements[:-1]: xpath += "//A:SHORT...
Find sub-element of given path with given short name. def get_element_by_path(tree, path_and_name, namespace): # type: (_Element, str, str) -> typing.Union[_Element, None] """Find sub-element of given path with given short name.""" global xml_element_cache namespace_map = {'A': namespace[1:-1]} bas...
Get element from ArTree by path. def get_cached_element_by_path(data_tree, path): # type: (ArTree, str) -> typing.Optional[_Element] """Get element from ArTree by path.""" if not isinstance(data_tree, ArTree): logger.warning("%s not called with ArTree, return None", get_cached_element_by_path.__nam...
Get first sub-child or referenced sub-child with given name. def get_child(parent, tag_name, root_or_cache, namespace): # type: (_Element, str, _DocRoot, str) -> typing.Optional[_Element] """Get first sub-child or referenced sub-child with given name.""" # logger.debug("get_child: " + tag_name) if pare...
Get element short name. def get_element_name(parent, ns): # type: (_Element, str) -> str """Get element short name.""" name = parent.find('./' + ns + 'SHORT-NAME') if name is not None and name.text is not None: return name.text return ""
Add signals from xml to the Frame. def get_signals(signal_array, frame, root_or_cache, ns, multiplex_id, float_factory): # type: (typing.Sequence[_Element], canmatrix.Frame, _DocRoot, str, _MultiplexId, typing.Callable) -> None """Add signals from xml to the Frame.""" global signal_rxs group_id = 1 ...
Get element description from XML. def get_element_desc(element, ar_tree, ns): # type: (_Element, _DocRoot, str) -> str """Get element description from XML.""" desc = get_child(element, "DESC", ar_tree, ns) txt = get_child(desc, 'L-2[@L="DE"]', ar_tree, ns) if txt is None: txt = get_child(de...
Extract signal from ECUc file. def ecuc_extract_signal(signal_node, ns): # type: (_Element, str) -> canmatrix.Signal """Extract signal from ECUc file.""" attributes = signal_node.findall(".//" + ns + "DEFINITION-REF") # type: typing.Sequence[_Element] start_bit = None size = 0 is_little = Fals...
Append new child and return it. def append_child(self, name, child): # type: (str, typing.Any) -> ArTree """Append new child and return it.""" temp = ArTree(name, child) self._array.append(temp) return temp
Setup the root logger. Return the logger instance for possible further setting and use. To be used from CLI scripts only. def setup_logger(): # type: () -> logging.Logger """Setup the root logger. Return the logger instance for possible further setting and use. To be used from CLI scripts only. """ ...
Dynamic reconfiguration of the log level def set_log_level(logger, level): # type: (logging.Logger, int) -> None """Dynamic reconfiguration of the log level""" if level > 2: level = 2 if level < -1: level = -1 levels = { -1: logging.ERROR, 0: logging.WARN, 1: l...
export canmatrix-object as .sym file (compatible to PEAK-Systems) def dump(db, f, **options): # type: (canmatrix.CanMatrix, typing.IO, **typing.Any) -> None """ export canmatrix-object as .sym file (compatible to PEAK-Systems) """ global enum_dict global enums sym_encoding = options.get('symEx...
Get all PGN values for given frame. :param db: CanMatrix database :return: tuple of [pgn] and [arbitration_id] def list_pgn(db): # type: (canmatrix.CanMatrix) -> typing.Tuple[typing.List[int], typing.List[canmatrix.ArbitrationId]] """ Get all PGN values for given frame. :param db: CanMatrix d...
Yield arbitration ids which has the same pgn. def ids_sharing_same_pgn(id_x, pgn_x, id_y, pgn_y): # type: (typing.Sequence[canmatrix.ArbitrationId], typing.Sequence[int], typing.Sequence[canmatrix.ArbitrationId], typing.Sequence[int]) -> typing.Iterable[typing.Tuple[canmatrix.ArbitrationId, canmatrix.ArbitrationId...
Get string value for common strings. Method is far from complete but helping with odd arxml files. :param text_value: value in text like "true" :return: string for value like "1" def guess_value(text_value): # type: (str) -> str """ Get string value for common strings. Method is far from comp...
Create, populate and return the VersioneerConfig() object. def get_config(): """Create, populate and return the VersioneerConfig() object.""" # these strings are filled in when 'setup.py versioneer' creates # _version.py cfg = VersioneerConfig() cfg.VCS = "git" cfg.style = "pep440-post" cfg...
Decorator to mark a method as the handler for a particular VCS. def register_vcs_handler(vcs, method): # tyoe: (str, str) -> typing.Callable # decorator """Decorator to mark a method as the handler for a particular VCS.""" def decorate(f): """Store f in HANDLERS[vcs][method].""" if vcs not in...
Get version from 'git describe' in the root of the source tree. This only gets called if the git-archive 'subst' keywords were *not* expanded, and _version.py hasn't already been rewritten with a short version string, meaning we're inside a checked out source tree. def git_pieces_from_vcs(tag_prefix, root...
Get version information or return default if unable to do so. def get_versions(): """Get version information or return default if unable to do so.""" # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have # __file__, we can work backwards from there to the root. Some # py2exe/bbfreez...
Copy ECU(s) identified by Name or as Object from source CAN matrix to target CAN matrix. This function additionally copy all relevant Defines. :param ecu_or_glob: Ecu instance or glob pattern for Ecu name :param source_db: Source CAN matrix :param target_db: Destination CAN matrix def copy_ecu(ecu_or_...
Copy ECU(s) identified by Name or as Object from source CAN matrix to target CAN matrix. This function additionally copy all relevant Frames and Defines. :param ecu_or_glob: Ecu instance or glob pattern for Ecu name :param source_db: Source CAN matrix :param target_db: Destination CAN matrix def copy_...
Copy Signals identified by name from source CAN matrix to target CAN matrix. In target CanMatrix the signal is put without frame, just on top level. :param signal_glob: Signal glob pattern :param source_db: Source CAN matrix :param target_db: Destination CAN matrix def copy_signal(signal_glob, source_...
Copy a Frame identified by ArbitrationId from source CAN matrix to target CAN matrix. This function additionally copy all relevant ECUs and Defines. :param frame_id: Frame arbitration od :param source_db: Source CAN matrix :param target_db: Destination CAN matrix def copy_frame(frame_id, source_db, ta...
Lazy init yaml because canmatrix might not be fully loaded when loading this format. def __init_yaml(): """Lazy init yaml because canmatrix might not be fully loaded when loading this format.""" global _yaml_initialized if not _yaml_initialized: _yaml_initialized = True yaml.add_constructor...
Gets the XML field object of the given name. def get_field(self, name): """ Gets the XML field object of the given name. """ # Quicker in case the exact name was used. field = self._all_fields.get(name) if field is not None: return field for field_na...
Tries getting the value of the given field. Tries it in the following order: show (standard nice display), value (raw value), showname (extended nice display). :param name: The name of the field :param raw: Only return raw value :return: str of value def get_field_value(self, name, raw...
Sanitizes an XML field name (since it might have characters which would make it inaccessible as a python attribute). def _sanitize_field_name(self, field_name): """ Sanitizes an XML field name (since it might have characters which would make it inaccessible as a python attribute). """ f...
Returns all lines that represent the fields of the layer (both their names and values). def _get_all_field_lines(self): """ Returns all lines that represent the fields of the layer (both their names and values). """ for field in self._get_all_fields_with_alternates(): # Chan...
Gets a field by its "showname" (the name that appears in Wireshark's detailed display i.e. in 'User-Agent: Mozilla...', 'User-Agent' is the showname) Returns None if not found. def get_field_by_showname(self, showname): """ Gets a field by its "showname" (the name tha...
Gets a field by its full or partial name. def get_field(self, name): """Gets a field by its full or partial name.""" # We only make the wrappers here (lazily) to avoid creating a ton of objects needlessly. field = self._wrapped_fields.get(name) if field is None: is_fake = Fa...
Gets the field by name, or None if not found. def _get_internal_field_by_name(self, name): """Gets the field by name, or None if not found.""" field = self._all_fields.get(name, self._all_fields.get('%s.%s' % (self._full_name, name))) if field is not None: return field for f...
Creates the field lazily. If it's a simple field, wraps it in a container that adds extra features. If it's a nested layer, creates a layer for it. If it's an intermediate layer, copies over the relevant fields and creates a new layer for it. def _make_wrapped_field(self, name, field, ...
Checks whether the layer has the given field name. Can get a dotted name, i.e. layer.sublayer.subsublayer.field def has_field(self, dotted_name): """ Checks whether the layer has the given field name. Can get a dotted name, i.e. layer.sublayer.subsublayer.field """ parts...
Returns the special tshark parameters to be used according to the configuration of this class. def get_parameters(self, packet_count=None): """ Returns the special tshark parameters to be used according to the configuration of this class. """ params = super(InMemCapture, self).get_param...
Parses binary packets and return a list of parsed packets. DOES NOT CLOSE tshark. It must be closed manually by calling close() when you're done working with it. def parse_packets(self, binary_packets): """ Parses binary packets and return a list of parsed packets. DOES NOT CL...
DEPRECATED. Use parse_packet instead. This function adds the packet to the packets list, and also closes and reopens tshark for each packet. ============== Gets a binary (string) packet and parses & adds it to this capture. Returns the added packet. Use feed_packets if ...
Gets a list of binary packets, parses them using tshark and returns their parsed values. Keeps the packets in the internal packet list as well. By default, assumes the packets are ethernet packets. For another link type, supply the linktype argument (most can be found in the class LinkTypes) d...
Finds the path of the tshark executable. If the user has provided a path or specified a location in config.ini it will be used. Otherwise default locations will be searched. :param tshark_path: Path of the tshark binary :raises TSharkNotFoundException in case TShark is not found in any location. def g...