Package mobi :: Package mtld :: Package da :: Package device :: Module client_props :: Class ClientProps
[frames] | no frames]

Class ClientProps

                   object --+    
                            |    
post_walk_rules.PostWalkRules --+
                                |
                               ClientProps

This class is used by the main API class and should not be used directly. This class tries to extract properties provided from the client side component.


Copyright: Copyright (c) Afilias Technologies Limited 2021. All Rights Reserved.

Author: Afilias Technologies Limited

Nested Classes

Inherited from post_walk_rules.PostWalkRules: PostWalkRulesException

Instance Methods
 
__init__(self, tree)
x.__init__(...) initializes x; see help(type(x)) for signature
 
put_properties(self, client_side_properties, properties)
Merge the tree walk properties with the client side properties and run any additional rules based on the client side and tree walk properties.
 
parse_client_side_properties(self, client_side_properties, properties)
Parse the client side properties string into a dictionary, sets to Tree properties and returns the properties as dictionary.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  KEY_CP_RULES = u'cpr'
  KEY_USER_AGENT = u'ua'

Inherited from post_walk_rules.PostWalkRules: KEY_MATCHER_PROP_IDS_IN_USE, KEY_OPERATOR, KEY_PROPERTY_MATCHER, KEY_PROPERTY_VALUE, KEY_RULE_ARR, KEY_RULE_GROUPS, KEY_RULE_PROP_IDS_IN_USE, KEY_RULE_SET, KEY_RULE_SET_COUNT, branch, tree_provider

Properties

Inherited from object: __class__

Method Details

__init__(self, tree)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

put_properties(self, client_side_properties, properties)

 

Merge the tree walk properties with the client side properties and run any additional rules based on the client side and tree walk properties. The rules can define replacement or additional values for properties and can also provide a new User-Agent to be used for a second tree walk. This is a typically a fake User-Agent mapped to a device that cannot normally be detected such as the various iPhone models.

Parameters:
  • client_side_properties
  • properties

parse_client_side_properties(self, client_side_properties, properties)

 

Parse the client side properties string into a dictionary, sets to Tree properties and returns the properties as dictionary.

The client_side_properties is of the form:: bjs.webGl:1|sdeviceAspectRatio:16/10|iusableDisplayHeight:1050

Each key:value pair of the client_side_properties is checked for sanity, if it is not valid then the key:value will be ignored.

The first character of the property name is the type of the value.

Parameters:
  • client_side_properties - The client side properties string (from cookie)
  • properties