friendlypins.utils.base_object module

Base class exposing common functionality to all Pinterest primitives

class friendlypins.utils.base_object.BaseObject(url, rest_io, json_data=None)[source]

Bases: object

Common base class providing shared functionality for all Pinterest primitives

Parameters
  • url (str) – URL for this object, relative to the API root

  • rest_io (RestIO) – reference to the Pinterest REST API

  • json_data (dict) – Optional JSON response data describing this object if not provided, the class will lazy load response data when needed

static default_fields()[source]

Default implementation

static default_url(unique_id)[source]

Default implementation

classmethod from_json(json_data, rest_io)[source]

Factory method that instantiates an instance of this class from JSON response data loaded by the caller

Parameters
  • json_data (dict) – pre-loaded response data describing the object

  • rest_io (RestIO) – pre-initialized session object for communicating with the REST API

Returns

instance of this derived class, pre-initialized with the provided response data

property json

returns raw json representation of this object

Type

dict

refresh()[source]

Updates cached response data describing the state of this pin

NOTE: This method simply clears the internal cache, and updated information will automatically be pulled on demand as additional queries are made through the API