aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2017-12-13 22:37:24 +0100
committerGitHub <[email protected]>2017-12-13 22:37:24 +0100
commit6089d30cc277a8ba6ede89f90b1babcd89344200 (patch)
tree7081e22d39df24bcf9ae8cacef76c75dd939d64d /docs
parentd28b5725f4d239dd7baad991cff287916cc2532e (diff)
parentafaab2b8743a11f2a8567873df8ae6ed7873ebb5 (diff)
downloadmastodon.py-6089d30cc277a8ba6ede89f90b1babcd89344200.tar.gz
Merge pull request #114 from halcy/mastodon-2.1.0
Mastodon 2.1.0
Diffstat (limited to 'docs')
-rw-r--r--docs/index.rst111
1 files changed, 102 insertions, 9 deletions
diff --git a/docs/index.rst b/docs/index.rst
index dfd91ab..4dd6403 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -134,7 +134,7 @@ If you are only interested in the fact an error was raised somewhere in
134Mastodon.py, and not the details, this is the exception you can catch. 134Mastodon.py, and not the details, this is the exception you can catch.
135 135
136`MastodonIllegalArgumentError` is generally a programming problem - you asked the 136`MastodonIllegalArgumentError` is generally a programming problem - you asked the
137API to do something obviously invalid (i.e. specify a privacy scope that does 137API to do something obviously invalid (i.e. specify a privacy option that does
138not exist). 138not exist).
139 139
140`MastodonFileNotFoundError` and `MastodonNetworkError` are IO errors - could be you 140`MastodonFileNotFoundError` and `MastodonNetworkError` are IO errors - could be you
@@ -156,6 +156,8 @@ and are parsed into python datetime objects.
156 156
157User dicts 157User dicts
158~~~~~~~~~~ 158~~~~~~~~~~
159.. _user dict:
160
159.. code-block:: python 161.. code-block:: python
160 162
161 mastodon.account(<numerical id>) 163 mastodon.account(<numerical id>)
@@ -176,10 +178,21 @@ User dicts
176 'header': # URL for their header image, can be animated 178 'header': # URL for their header image, can be animated
177 'avatar_static': # URL for their avatar, never animated 179 'avatar_static': # URL for their avatar, never animated
178 'header_static': # URL for their header image, never animated 180 'header_static': # URL for their header image, never animated
181 'source': # Additional information - only present for user dict returned from account_verify_credentials()
179 } 182 }
180 183
184 mastodon.account_verify_credentials()["source"]
185 # Returns the following dictionary:
186 {
187 'privacy': # The users default visibility setting ("private", "unlisted" or "public")
188 'sensitive': # Denotes whether user media should be marked sensitive by default
189 'note': # Plain text version of the users bio
190 }
191
181Toot dicts 192Toot dicts
182~~~~~~~~~~ 193~~~~~~~~~~
194.. _toot dict:
195
183.. code-block:: python 196.. code-block:: python
184 197
185 mastodon.toot("Hello from Python") 198 mastodon.toot("Hello from Python")
@@ -213,6 +226,8 @@ Toot dicts
213 226
214Mention dicts 227Mention dicts
215~~~~~~~~~~~~~ 228~~~~~~~~~~~~~
229.. _mention dict:
230
216.. code-block:: python 231.. code-block:: python
217 232
218 { 233 {
@@ -224,6 +239,8 @@ Mention dicts
224 239
225Hashtag dicts 240Hashtag dicts
226~~~~~~~~~~~~~ 241~~~~~~~~~~~~~
242.. _hashtag dict:
243
227.. code-block:: python 244.. code-block:: python
228 245
229 { 246 {
@@ -233,6 +250,8 @@ Hashtag dicts
233 250
234Emoji dicts 251Emoji dicts
235~~~~~~~~~~~ 252~~~~~~~~~~~
253.. _emoji dict:
254
236.. code-block:: python 255.. code-block:: python
237 256
238 { 257 {
@@ -243,6 +262,8 @@ Emoji dicts
243 262
244Relationship dicts 263Relationship dicts
245~~~~~~~~~~~~~~~~~~ 264~~~~~~~~~~~~~~~~~~
265.. _relationship dict:
266
246.. code-block:: python 267.. code-block:: python
247 268
248 mastodon.account_follow(<numerical id>) 269 mastodon.account_follow(<numerical id>)
@@ -259,21 +280,25 @@ Relationship dicts
259 280
260Notification dicts 281Notification dicts
261~~~~~~~~~~~~~~~~~~ 282~~~~~~~~~~~~~~~~~~
283.. _notification dict:
284
262.. code-block:: python 285.. code-block:: python
263 286
264 mastodon.notifications()[0] 287 mastodon.notifications()[0]
265 # Returns the following dictionary: 288 # Returns the following dictionary:
266 { 289 {
267 'id': # id of the notification. 290 'id': # id of the notification
268 'type': # "mention", "reblog", "favourite" or "follow". 291 'type': # "mention", "reblog", "favourite" or "follow"
269 'created_at': # The time the notification was created. 292 'created_at': # The time the notification was created
270 'account': # User dict of the user from whom the notification originates. 293 'account': # User dict of the user from whom the notification originates
271 'status': # In case of "mention", the mentioning status. 294 'status': # In case of "mention", the mentioning status
272 # In case of reblog / favourite, the reblogged / favourited status. 295 # In case of reblog / favourite, the reblogged / favourited status
273 } 296 }
274 297
275Context dicts 298Context dicts
276~~~~~~~~~~~~~ 299~~~~~~~~~~~~~
300.. _context dict:
301
277.. code-block:: python 302.. code-block:: python
278 303
279 mastodon.status_context(<numerical id>) 304 mastodon.status_context(<numerical id>)
@@ -283,8 +308,23 @@ Context dicts
283 'descendants': # A list of toot dicts 308 'descendants': # A list of toot dicts
284 } 309 }
285 310
311List dicts
312~~~~~~~~~~
313.. _list dict:
314
315.. code-block:: python
316
317 mastodon.list(<numerical id>)
318 # Returns the following dictionary:
319 {
320 'id': # id of the list
321 'title': # title of the list
322 }
323
286Media dicts 324Media dicts
287~~~~~~~~~~~ 325~~~~~~~~~~~
326.. _media dict:
327
288.. code-block:: python 328.. code-block:: python
289 329
290 mastodon.media_post("image.jpg", "image/jpeg") 330 mastodon.media_post("image.jpg", "image/jpeg")
@@ -309,6 +349,8 @@ Media dicts
309 349
310Card dicts 350Card dicts
311~~~~~~~~~~ 351~~~~~~~~~~
352.. _card dict:
353
312.. code-block:: python 354.. code-block:: python
313 355
314 mastodon.status_card(<numerical id>): 356 mastodon.status_card(<numerical id>):
@@ -331,8 +373,24 @@ Card dicts
331 'provider_url': # URL pointing to the embeds provider 373 'provider_url': # URL pointing to the embeds provider
332 } 374 }
333 375
376Search result dicts
377~~~~~~~~~~~~~~~~~~~
378.. _search result dict:
379
380.. code-block:: python
381
382 mastodon.search("<query>")
383 # Returns the folowing dictionary
384 {
385 'accounts': # List of account dicts resulting from the query
386 'hashtags': # List of hashtag dicts resulting from the query
387 'statuses': # List of toot dicts resulting from the query
388 }
389
334Instance dicts 390Instance dicts
335~~~~~~~~~~~~~~ 391~~~~~~~~~~~~~~
392.. _instance dict:
393
336.. code-block:: python 394.. code-block:: python
337 395
338 mastodon.instance() 396 mastodon.instance()
@@ -348,6 +406,8 @@ Instance dicts
348 406
349Report dicts 407Report dicts
350~~~~~~~~~~~~ 408~~~~~~~~~~~~
409.. _report dict:
410
351.. code-block:: python 411.. code-block:: python
352 412
353 mastodon.reports()[0] 413 mastodon.reports()[0]
@@ -383,6 +443,7 @@ is specified, Mastodon.py defaults to https.
383 443
384.. automethod:: Mastodon.create_app 444.. automethod:: Mastodon.create_app
385.. automethod:: Mastodon.__init__ 445.. automethod:: Mastodon.__init__
446.. _log_in():
386.. automethod:: Mastodon.log_in 447.. automethod:: Mastodon.log_in
387.. automethod:: Mastodon.auth_request_url 448.. automethod:: Mastodon.auth_request_url
388 449
@@ -413,11 +474,14 @@ Reading data: Timelines
413This function allows you to access the timelines a logged in 474This function allows you to access the timelines a logged in
414user could see, as well as hashtag timelines and the public timeline. 475user could see, as well as hashtag timelines and the public timeline.
415 476
477.. _timeline():
416.. automethod:: Mastodon.timeline 478.. automethod:: Mastodon.timeline
417.. automethod:: Mastodon.timeline_home 479.. automethod:: Mastodon.timeline_home
418.. automethod:: Mastodon.timeline_local 480.. automethod:: Mastodon.timeline_local
419.. automethod:: Mastodon.timeline_public 481.. automethod:: Mastodon.timeline_public
482.. _timeline_hashtag():
420.. automethod:: Mastodon.timeline_hashtag 483.. automethod:: Mastodon.timeline_hashtag
484.. automethod:: Mastodon.timeline_list
421 485
422Reading data: Statuses 486Reading data: Statuses
423---------------------- 487----------------------
@@ -448,6 +512,14 @@ their relationships.
448.. automethod:: Mastodon.account_relationships 512.. automethod:: Mastodon.account_relationships
449.. automethod:: Mastodon.account_search 513.. automethod:: Mastodon.account_search
450 514
515Reading data: Lists
516-------------------
517These functions allow you to view information about lists.
518
519.. automethod:: Mastodon.lists
520.. automethod:: Mastodon.list
521.. automethod:: Mastodon.list_accounts
522
451Reading data: Follows 523Reading data: Follows
452--------------------- 524---------------------
453 525
@@ -468,7 +540,6 @@ Reading data: Searching
468 540
469.. automethod:: Mastodon.search 541.. automethod:: Mastodon.search
470 542
471
472Reading data: Mutes and blocks 543Reading data: Mutes and blocks
473------------------------------ 544------------------------------
474These functions allow you to get information about accounts that are 545These functions allow you to get information about accounts that are
@@ -487,11 +558,17 @@ Reading data: Domain blocks
487 558
488.. automethod:: Mastodon.domain_blocks 559.. automethod:: Mastodon.domain_blocks
489 560
561Reading data: Emoji
562-------------------
563
564.. automethod:: Mastodon.custom_emojis
565
490Writing data: Statuses 566Writing data: Statuses
491---------------------- 567----------------------
492These functions allow you to post statuses to Mastodon and to 568These functions allow you to post statuses to Mastodon and to
493interact with already posted statuses. 569interact with already posted statuses.
494 570
571.. _status_post():
495.. automethod:: Mastodon.status_post 572.. automethod:: Mastodon.status_post
496.. automethod:: Mastodon.toot 573.. automethod:: Mastodon.toot
497.. automethod:: Mastodon.status_reblog 574.. automethod:: Mastodon.status_reblog
@@ -523,6 +600,19 @@ These functions allow you to interact with other accounts: To (un)follow and
523.. automethod:: Mastodon.account_unmute 600.. automethod:: Mastodon.account_unmute
524.. automethod:: Mastodon.account_update_credentials 601.. automethod:: Mastodon.account_update_credentials
525 602
603Writing data: Lists
604-------------------
605These functions allow you to create, maintain and delete lists.
606
607When creating lists, note that (As of Mastodon 2.1.0), a user can only
608have a maximum of 50 lists.
609
610.. automethod:: Mastodon.list_create
611.. automethod:: Mastodon.list_update
612.. automethod:: Mastodon.list_delete
613.. automethod:: Mastodon.list_accounts_add
614.. automethod:: Mastodon.list_accounts_delete
615
526Writing data: Follow requests 616Writing data: Follow requests
527----------------------------- 617-----------------------------
528These functions allow you to accept or reject incoming follow requests. 618These functions allow you to accept or reject incoming follow requests.
@@ -536,6 +626,8 @@ This function allows you to upload media to Mastodon. The returned
536media IDs (Up to 4 at the same time) can then be used with post_status 626media IDs (Up to 4 at the same time) can then be used with post_status
537to attach media to statuses. 627to attach media to statuses.
538 628
629.. _media_post():
630
539.. automethod:: Mastodon.media_post 631.. automethod:: Mastodon.media_post
540 632
541Writing data: Reports 633Writing data: Reports
@@ -571,7 +663,7 @@ will return a handle corresponding to the open connection. The
571connection may be closed at any time by calling the handles close() method, and the 663connection may be closed at any time by calling the handles close() method, and the
572status of the connection can be verified calling is_alive() on the handle. 664status of the connection can be verified calling is_alive() on the handle.
573 665
574The streaming functions take instances of `StreamListener` as a parameter. 666The streaming functions take instances of `StreamListener` as the `listener` parameter.
575A `CallbackStreamListener` class that allows you to specify function callbacks 667A `CallbackStreamListener` class that allows you to specify function callbacks
576directly is included for convenience. 668directly is included for convenience.
577 669
@@ -579,6 +671,7 @@ directly is included for convenience.
579.. automethod:: Mastodon.stream_public 671.. automethod:: Mastodon.stream_public
580.. automethod:: Mastodon.stream_local 672.. automethod:: Mastodon.stream_local
581.. automethod:: Mastodon.stream_hashtag 673.. automethod:: Mastodon.stream_hashtag
674.. automethod:: Mastodon.stream_list
582 675
583StreamListener 676StreamListener
584~~~~~~~~~~~~~~ 677~~~~~~~~~~~~~~
Powered by cgit v1.2.3 (git 2.41.0)