Vimeo Tools Vimeo Base Module
This module contains the base classes VimeoChild and VimeoItem, as well as functions used by the other classes.
- Author
Georg Pfolz
- Concering names used for variables and functions:
The term “property” is used for the data coming from returned by the Vimeo API. It’s what’s called “parameters” in the Vimeo API documentation.
The term “attribute” is used for the data stored in the VimeoItem objects. These are temporary data that are lost when the object is deleted.
- class VimeoBaseItem(connection, code_or_uri=None, live=False, data=None, data_object=None)
Bases:
objectAn abstract class to represent a Vimeo Item. This is the base of the VimeoFolder, VimeoVideo and VimeoShowcase classes.
One key method is get_data(), which not only returns the item’s data but also stores it in the object for future use. If the refresh parameter is not set to True, the data will not be fetched again from the API in subsequent calls to get_data().
- Parameters
connection (VimeoConnection) –
code_or_uri (Optional[str]) –
live (bool) –
data (Optional[Dict[str, Any]]) –
data_object (Optional[VimeoData]) –
- BASE_URI = '/me'
- property attributes: Dict[str, Any]
- Return type
Dict[str,Any]
- property code: str
- Return type
str
- property created_time: str
- Return type
str
- property description
- property duration: str
- Return type
str
- property embed: str
- Return type
str
- get_attribute(name)
- Return type
Any- Parameters
name (str) –
- get_attributes()
- Return type
Dict[str,Any]
- get_data(refresh=False)
- Return type
Dict- Parameters
refresh (bool) –
- get_property(property, refresh=False)
- Return type
Any- Parameters
property (str) –
refresh (bool) –
- get_user()
- Return type
str
- get_user_data()
- Return type
Dict[str,Any]
- get_user_link()
- Return type
str
- get_user_name()
- Return type
str
- get_user_uri()
- Return type
str
- key = 'link'
- property link: str
- Return type
str
- property live: bool
- Return type
bool
- property metadata: str
- Return type
str
- property modified_time: str
- Return type
str
- property name
- property pictures: str
- Return type
str
- property privacy: str
- Return type
str
- refresh()
- property resource_key: str
- Return type
str
- set_attribute(name, value)
This stores temporary attributes in the object. This is useful for storing data that’s needed e.g. for program logic but not to be stored on Vimeo.
- Return type
None- Parameters
name (str) –
value (Any) –
- set_property(name, value)
Set a property of the item. The property must be setable.
- Parameters
key – The key can be provided in dotted notation, e.g. “privacy.view”
value (
Any) – The value to setname (str) –
- set_temp_data(value)
despite there begin a setter, this is needed to set temp_data from Restricted Python (Zope)
- Return type
None- Parameters
value (Dict[str, Any]) –
- store_json(path=None, refresh=False)
Store data as a json file. :type path:
Optional[str] :param path: str :return: None- Parameters
path (Optional[str]) –
refresh (bool) –
- property temp_data: Dict[str, Any]
- Return type
Dict[str,Any]
- property uri: str
- Return type
str
- property user: str
- Return type
str
- property user_id: str
- Return type
str
- property user_name: str
- Return type
str
- property user_uri: str
- Return type
str
- val = {'type': <class 'str'>}
- class VimeoChild
Bases:
objectA class to represent a Vimeo Child. This is a base class of the VimeoVideo and VimeoFolder classes.
- get_parent_folder(refresh=False)
Get the parent folder of this item. :type refresh:
bool:param refresh: bool :rtype:VimeoFolder:return: VimeoFolder- Parameters
refresh (bool) –
- Return type
- get_parent_folder_code(refresh=False)
- Return type
str- Parameters
refresh (bool) –
- get_parent_folder_data(keys=None, refresh=False)
- Return type
Dict[str,Any]- Parameters
keys (Optional[List[str]]) –
refresh (bool) –
- get_parent_folder_link(refresh=False)
- Return type
str- Parameters
refresh (bool) –
- get_parent_folder_name(refresh=False)
- Return type
str- Parameters
refresh (bool) –
- get_parent_folder_privacy(refresh=False)
- Return type
str- Parameters
refresh (bool) –
- get_parent_folder_privacy_view(refresh=False)
- Return type
str- Parameters
refresh (bool) –
- get_parent_folder_uri(refresh=False)
- Return type
str- Parameters
refresh (bool) –
- get_parent_folder_user(refresh=False)
- Return type
str- Parameters
refresh (bool) –
- get_parent_folder_user_data(refresh=False)
- Return type
Dict[str,Any]- Parameters
refresh (bool) –
- get_parent_folder_user_uri(refresh=False)
- Return type
str- Parameters
refresh (bool) –
- class VimeoItem(connection, code_or_uri, data=None, data_object=None)
Bases:
VimeoBaseItemAn abstract class to represent a Vimeo Item. This is the base of the Video and Showcase classes.
- Parameters
connection (VimeoConnection) –
code_or_uri (str) –
data (Optional[Dict[str, Any]]) –
data_object (Optional[VimeoData]) –
- get_description(refresh=False)
- Return type
str- Parameters
refresh (bool) –
- denest_key(key, value=None, data={})
- Return type
Dict[str,Any]- Parameters
key (str) –
value (Optional[Any]) –
data (Optional[Dict[str, Any]]) –
- get_lines(key, value, bullet='*', indent=0)
Print a str, list or dict in a pretty way. :type key:
str:param key: str = ‘’ # key name :type indent:int:param indent: int = 0 # number of spaces to indent :param bullet: str = ‘*’ # bullet character :return: None- Parameters
key (str) –
value (Union[List[Any], Dict[str, Any]]) –
indent (int) –
- nested_value(data, path)
Get a nested value from a dictionary using a list of keys as the path.
- Return type
Any- Parameters
data (Dict[str, Any]) –
path (Union[List[str], str]) –
- transform_returning(returning)
- Return type
str- Parameters
returning (str) –
- transform_what(what)
- Return type
str- Parameters
what (str) –
- update_nested_data(data, update_data)
Update nested data in a dictionary using another dictionary with the same structure.
- Parameters
data (Dict[str, Any]) –
update_data (Dict[str, Any]) –