1 #### `Post()` object and posting
3 `Post` object is used to represent a post on D\*.
9 Use this method to get or update the post. As first parameter a `bool`
10 can be given wich if is `True` will also fetch comments, default it
15 Set or get the current data for this post. If this method is called
16 without any argument it will return a dict with the post data. To set
17 post data for this post use the post data to set as first parameter
18 (normaly you don't want to set this manualy).
30 Comments on this post. First parameter a `str` with the text to comment.
34 If the post contains a poll, you can vote on it by calling this method
35 with as parameter the poll **answer** `id`.
43 Blocks the post author.
47 Subscribes to this post (receive notifications on this post and its
52 Unsubscribes from this post if you don't want to receive any
53 notifications about this post anymore.
56 This function is `TODO`, it doesn't work yet.
60 If you own this post you can delete it by calling this method.
62 ##### `delete_comment()`
64 If you commented on this post and want to delete the comment call this
65 method with as paramter the **comment** `id`.
69 If you liked this post you can call `delete_like()` to undo that.
73 By default it returns the **author** `name`. As parameter you can give
74 another key like **`id`**, **`guid`**, **`diaspora_id`** or
75 **`avatar`**. *Note*: parameter is expected to be a `str`.
81 Posting is done through a `Stream` object method `post()`.
82 It supports posting just text, images, a poll and a combination of those.
84 Additional you can set the provider name displayed in the post (wich can
85 be your application it's name.) by setting the `provider_display_name`
86 parameter wich expects a `str`.
88 `Stream().post()` returns `Post` object referring to the post
89 which have just been created.
94 If you want to post just text you should call `post()` method with
97 stream.post(text='Your post.')
99 It will return `Post` you have just created.
103 If you want to post a poll you have to provide the following:
105 * A `str` as the `poll_question` parameter wich will represent the poll
107 * A `list` with strings as the `poll_answers` parameter wich represent
112 Posting images, from back-end point of view, is a two-step process.
113 First, you have to *upload* an image to the desired pod.
114 This is done by `_photoupload()` method.
115 It will return *id* of uploaded image.
117 Then you have to actually post your image and this is done by appending
118 `photos` field containg the id of uploaded image to the data being
119 sent by request. This is handled by `post()` method.
121 `post()` has two very similar arguments used for posting photos.
122 They are `photos` - which takes id and `photo` - which takes filename.
124 You can post images using either of them. Even passing them side by side
125 is accepted but remember that `photos` will overwrite data set by
129 Example #1: using `photo`
132 stream.post(photo='./kitten-image.png')
135 Example #2: using `photos`
138 id = stream._photoupload(filename='./kitten-image.png')
139 stream.post(photos=id)
142 The effect will be the same.
143 To either call you can append `text` argument which will be posted
148 ###### Manual for `diaspy`, written by Marek Marecki