Classes¶
Classes module. These are objects goldfinchsong uses to keep state and perform business logic.
-
class
goldfinchsong.classes.
Manager
(credentials=None, db=None, image_directory=None, text_conversions=None)¶ Manages tweet posting through twitter API.
-
api
¶ A tweepy API instance.
-
db
¶ TinyDB
A database (TinyDB) instance for storing tweet image history.
-
content
¶ tuple
The class expects a tuple with a file name string and status text string.
-
post_tweet
()¶ Attempts a tweet status post with image.
After a successful tweet update call, the method saves a dict to the Manager’s db property. The format of the dict saved is:
{ 'image': 'just-the-image-name-not-full-path.jpg', 'delivered_on': '2016-05-04T17:06:54.987654+00:00' }
The image name is the file name of the image alone, not the path to the image. The delivery timestamp is an ISO 8601 time string; Python’s built-in libraries omit the allowed ‘Z’ is in favor of just a
+
or-
marker. The goldfinchsong timestamps use UTC, so the increment will be00:00
as in the above example.Returns: A content tuple with the full image path, status text, and image file name. Return type: tuple Raises: Exception
– Raises exception if content property isNone
.
-