diff options
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 553 | ||||
-rw-r--r-- | mastodon/accounts.py | 105 | ||||
-rw-r--r-- | mastodon/internals.py | 11 | ||||
-rw-r--r-- | mastodon/versions.py | 40 |
4 files changed, 363 insertions, 346 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index ad8e963..76dccd3 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -17,7 +17,8 @@ import copy | |||
17 | 17 | ||
18 | 18 | ||
19 | from .compat import IMPL_HAS_CRYPTO, IMPL_HAS_ECE, IMPL_HAS_BLURHASH | 19 | from .compat import IMPL_HAS_CRYPTO, IMPL_HAS_ECE, IMPL_HAS_BLURHASH |
20 | from .compat import cryptography, default_backend, ec, serialization, http_ece | 20 | from .compat import cryptography, default_backend, ec, serialization |
21 | from .compat import http_ece | ||
21 | from .compat import blurhash | 22 | from .compat import blurhash |
22 | from .compat import urlparse | 23 | from .compat import urlparse |
23 | 24 | ||
@@ -25,61 +26,34 @@ from .utility import parse_version_string, max_version, api_version | |||
25 | from .utility import AttribAccessDict, AttribAccessDict | 26 | from .utility import AttribAccessDict, AttribAccessDict |
26 | 27 | ||
27 | from .error import * | 28 | from .error import * |
29 | from .versions import _DICT_VERSION_APPLICATION, _DICT_VERSION_MENTION, _DICT_VERSION_MEDIA, _DICT_VERSION_ACCOUNT, _DICT_VERSION_POLL, \ | ||
30 | _DICT_VERSION_STATUS, _DICT_VERSION_INSTANCE, _DICT_VERSION_HASHTAG, _DICT_VERSION_EMOJI, _DICT_VERSION_RELATIONSHIP, \ | ||
31 | _DICT_VERSION_NOTIFICATION, _DICT_VERSION_CONTEXT, _DICT_VERSION_LIST, _DICT_VERSION_CARD, _DICT_VERSION_SEARCHRESULT, \ | ||
32 | _DICT_VERSION_ACTIVITY, _DICT_VERSION_REPORT, _DICT_VERSION_PUSH, _DICT_VERSION_PUSH_NOTIF, _DICT_VERSION_FILTER, \ | ||
33 | _DICT_VERSION_CONVERSATION, _DICT_VERSION_SCHEDULED_STATUS, _DICT_VERSION_PREFERENCES, _DICT_VERSION_ADMIN_ACCOUNT, \ | ||
34 | _DICT_VERSION_FEATURED_TAG, _DICT_VERSION_MARKER, _DICT_VERSION_REACTION, _DICT_VERSION_ANNOUNCEMENT, _DICT_VERSION_STATUS_EDIT, \ | ||
35 | _DICT_VERSION_FAMILIAR_FOLLOWERS, _DICT_VERSION_ADMIN_DOMAIN_BLOCK, _DICT_VERSION_ADMIN_MEASURE, _DICT_VERSION_ADMIN_DIMENSION, \ | ||
36 | _DICT_VERSION_ADMIN_RETENTION | ||
37 | |||
28 | from .defaults import _DEFAULT_TIMEOUT, _DEFAULT_SCOPES, _DEFAULT_STREAM_TIMEOUT, _DEFAULT_STREAM_RECONNECT_WAIT_SEC | 38 | from .defaults import _DEFAULT_TIMEOUT, _DEFAULT_SCOPES, _DEFAULT_STREAM_TIMEOUT, _DEFAULT_STREAM_RECONNECT_WAIT_SEC |
29 | from .defaults import _SCOPE_SETS | 39 | from .defaults import _SCOPE_SETS |
30 | 40 | ||
31 | from .internals import Mastodon as Internals | 41 | from .internals import Mastodon as Internals |
42 | from .accounts import Mastodon as Accounts | ||
32 | 43 | ||
33 | ## | 44 | ## |
34 | # The actual Mastodon class | 45 | # The actual Mastodon class |
35 | ### | 46 | ### |
36 | class Mastodon(Internals): | 47 | class Mastodon(Internals, Accounts): |
37 | """ | 48 | """ |
38 | Thorough and easy to use Mastodon | 49 | Thorough and easy to use Mastodon |
39 | API wrapper in Python. | 50 | API wrapper in Python. |
40 | 51 | ||
41 | Main class, imports most things from modules | 52 | Main class, imports most things from modules |
42 | """ | 53 | """ |
43 | |||
44 | # Support level | 54 | # Support level |
45 | __SUPPORTED_MASTODON_VERSION = "3.5.5" | 55 | __SUPPORTED_MASTODON_VERSION = "3.5.5" |
46 | 56 | ||
47 | # Dict versions | ||
48 | __DICT_VERSION_APPLICATION = "2.7.2" | ||
49 | __DICT_VERSION_MENTION = "1.0.0" | ||
50 | __DICT_VERSION_MEDIA = "3.2.0" | ||
51 | __DICT_VERSION_ACCOUNT = "3.3.0" | ||
52 | __DICT_VERSION_POLL = "2.8.0" | ||
53 | __DICT_VERSION_STATUS = max_version("3.1.0", __DICT_VERSION_MEDIA, __DICT_VERSION_ACCOUNT, __DICT_VERSION_APPLICATION, __DICT_VERSION_MENTION, __DICT_VERSION_POLL) | ||
54 | __DICT_VERSION_INSTANCE = max_version("3.4.0", __DICT_VERSION_ACCOUNT) | ||
55 | __DICT_VERSION_HASHTAG = "2.3.4" | ||
56 | __DICT_VERSION_EMOJI = "3.0.0" | ||
57 | __DICT_VERSION_RELATIONSHIP = "3.3.0" | ||
58 | __DICT_VERSION_NOTIFICATION = max_version("3.5.0", __DICT_VERSION_ACCOUNT, __DICT_VERSION_STATUS) | ||
59 | __DICT_VERSION_CONTEXT = max_version("1.0.0", __DICT_VERSION_STATUS) | ||
60 | __DICT_VERSION_LIST = "2.1.0" | ||
61 | __DICT_VERSION_CARD = "3.2.0" | ||
62 | __DICT_VERSION_SEARCHRESULT = max_version("1.0.0", __DICT_VERSION_ACCOUNT, __DICT_VERSION_STATUS, __DICT_VERSION_HASHTAG) | ||
63 | __DICT_VERSION_ACTIVITY = "2.1.2" | ||
64 | __DICT_VERSION_REPORT = "2.9.1" | ||
65 | __DICT_VERSION_PUSH = "2.4.0" | ||
66 | __DICT_VERSION_PUSH_NOTIF = "2.4.0" | ||
67 | __DICT_VERSION_FILTER = "2.4.3" | ||
68 | __DICT_VERSION_CONVERSATION = max_version("2.6.0", __DICT_VERSION_ACCOUNT, __DICT_VERSION_STATUS) | ||
69 | __DICT_VERSION_SCHEDULED_STATUS = max_version("2.7.0", __DICT_VERSION_STATUS) | ||
70 | __DICT_VERSION_PREFERENCES = "2.8.0" | ||
71 | __DICT_VERSION_ADMIN_ACCOUNT = max_version("4.0.0", __DICT_VERSION_ACCOUNT) | ||
72 | __DICT_VERSION_FEATURED_TAG = "3.0.0" | ||
73 | __DICT_VERSION_MARKER = "3.0.0" | ||
74 | __DICT_VERSION_REACTION = "3.1.0" | ||
75 | __DICT_VERSION_ANNOUNCEMENT = max_version("3.1.0", __DICT_VERSION_REACTION) | ||
76 | __DICT_VERSION_STATUS_EDIT = "3.5.0" | ||
77 | __DICT_VERSION_FAMILIAR_FOLLOWERS = max_version("3.5.0", __DICT_VERSION_ACCOUNT) | ||
78 | __DICT_VERSION_ADMIN_DOMAIN_BLOCK = "4.0.0" | ||
79 | __DICT_VERSION_ADMIN_MEASURE = "3.5.0" | ||
80 | __DICT_VERSION_ADMIN_DIMENSION = "3.5.0" | ||
81 | __DICT_VERSION_ADMIN_RETENTION = "3.5.0" | ||
82 | |||
83 | ### | 57 | ### |
84 | # Registering apps | 58 | # Registering apps |
85 | ### | 59 | ### |
@@ -306,83 +280,6 @@ class Mastodon(Internals): | |||
306 | if ratelimit_method not in ["throw", "wait", "pace"]: | 280 | if ratelimit_method not in ["throw", "wait", "pace"]: |
307 | raise MastodonIllegalArgumentError("Invalid ratelimit method.") | 281 | raise MastodonIllegalArgumentError("Invalid ratelimit method.") |
308 | 282 | ||
309 | def set_language(self, lang): | ||
310 | """ | ||
311 | Set the locale Mastodon will use to generate responses. Valid parameters are all ISO 639-1 (two letter) or, for languages that do | ||
312 | not have one, 639-3 (three letter) language codes. This affects some error messages (those related to validation) and trends. | ||
313 | """ | ||
314 | self.lang = lang | ||
315 | |||
316 | def __normalize_version_string(self, version_string): | ||
317 | # Split off everything after the first space, to take care of Pleromalikes so that the parser doesn't get confused in case those have a + somewhere in their version | ||
318 | version_string = version_string.split(" ")[0] | ||
319 | try: | ||
320 | # Attempt to split at + and check if the part after parses as a version string, to account for hometown | ||
321 | parse_version_string(version_string.split("+")[1]) | ||
322 | return version_string.split("+")[1] | ||
323 | except: | ||
324 | # If this fails, assume that if there is a +, what is before that is the masto version (or that there is no +) | ||
325 | return version_string.split("+")[0] | ||
326 | |||
327 | def retrieve_mastodon_version(self): | ||
328 | """ | ||
329 | Determine installed Mastodon version and set major, minor and patch (not including RC info) accordingly. | ||
330 | |||
331 | Returns the version string, possibly including rc info. | ||
332 | """ | ||
333 | try: | ||
334 | version_str = self.__normalize_version_string(self.__instance()["version"]) | ||
335 | self.version_check_worked = True | ||
336 | except: | ||
337 | # instance() was added in 1.1.0, so our best guess is 1.0.0. | ||
338 | version_str = "1.0.0" | ||
339 | self.version_check_worked = False | ||
340 | |||
341 | self.mastodon_major, self.mastodon_minor, self.mastodon_patch = parse_version_string(version_str) | ||
342 | return version_str | ||
343 | |||
344 | def verify_minimum_version(self, version_str, cached=False): | ||
345 | """ | ||
346 | Update version info from server and verify that at least the specified version is present. | ||
347 | |||
348 | If you specify "cached", the version info update part is skipped. | ||
349 | |||
350 | Returns True if version requirement is satisfied, False if not. | ||
351 | """ | ||
352 | if not cached: | ||
353 | self.retrieve_mastodon_version() | ||
354 | major, minor, patch = parse_version_string(version_str) | ||
355 | if major > self.mastodon_major: | ||
356 | return False | ||
357 | elif major == self.mastodon_major and minor > self.mastodon_minor: | ||
358 | return False | ||
359 | elif major == self.mastodon_major and minor == self.mastodon_minor and patch > self.mastodon_patch: | ||
360 | return False | ||
361 | return True | ||
362 | |||
363 | def get_approx_server_time(self): | ||
364 | """ | ||
365 | Retrieve the approximate server time | ||
366 | |||
367 | We parse this from the hopefully present "Date" header, but make no effort to compensate for latency. | ||
368 | """ | ||
369 | response = self.__api_request("HEAD", "/", return_response_object=True) | ||
370 | if 'Date' in response.headers: | ||
371 | server_time_datetime = dateutil.parser.parse(response.headers['Date']) | ||
372 | |||
373 | # Make sure we're in local time | ||
374 | epoch_time = self.__datetime_to_epoch(server_time_datetime) | ||
375 | return datetime.datetime.fromtimestamp(epoch_time) | ||
376 | else: | ||
377 | raise MastodonAPIError("No server time in response.") | ||
378 | |||
379 | @staticmethod | ||
380 | def get_supported_version(): | ||
381 | """ | ||
382 | Retrieve the maximum version of Mastodon supported by this version of Mastodon.py | ||
383 | """ | ||
384 | return Mastodon.__SUPPORTED_MASTODON_VERSION | ||
385 | |||
386 | def auth_request_url(self, client_id=None, redirect_uris="urn:ietf:wg:oauth:2.0:oob", scopes=_DEFAULT_SCOPES, force_login=False, state=None, lang=None): | 283 | def auth_request_url(self, client_id=None, redirect_uris="urn:ietf:wg:oauth:2.0:oob", scopes=_DEFAULT_SCOPES, force_login=False, state=None, lang=None): |
387 | """ | 284 | """ |
388 | Returns the URL that a client needs to request an OAuth grant from the server. | 285 | Returns the URL that a client needs to request an OAuth grant from the server. |
@@ -516,112 +413,76 @@ class Mastodon(Internals): | |||
516 | self.access_token = None | 413 | self.access_token = None |
517 | self.__logged_in_id = None | 414 | self.__logged_in_id = None |
518 | 415 | ||
519 | @api_version("2.7.0", "2.7.0", "3.4.0") | 416 | def set_language(self, lang): |
520 | def create_account(self, username, password, email, agreement=False, reason=None, locale="en", scopes=_DEFAULT_SCOPES, to_file=None, return_detailed_error=False): | 417 | """ |
521 | """ | 418 | Set the locale Mastodon will use to generate responses. Valid parameters are all ISO 639-1 (two letter) or, for languages that do |
522 | Creates a new user account with the given username, password and email. "agreement" | 419 | not have one, 639-3 (three letter) language codes. This affects some error messages (those related to validation) and trends. |
523 | must be set to true (after showing the user the instance's user agreement and having | 420 | """ |
524 | them agree to it), "locale" specifies the language for the confirmation email as an | 421 | self.lang = lang |
525 | ISO 639-1 (two letter) or, if a language does not have one, 639-3 (three letter) language | 422 | |
526 | code. `reason` can be used to specify why a user would like to join if approved-registrations | 423 | def retrieve_mastodon_version(self): |
527 | mode is on. | 424 | """ |
528 | 425 | Determine installed Mastodon version and set major, minor and patch (not including RC info) accordingly. | |
529 | Does not require an access token, but does require a client grant. | ||
530 | |||
531 | By default, this method is rate-limited by IP to 5 requests per 30 minutes. | ||
532 | |||
533 | Returns an access token (just like log_in), which it can also persist to to_file, | ||
534 | and sets it internally so that the user is now logged in. Note that this token | ||
535 | can only be used after the user has confirmed their email. | ||
536 | |||
537 | By default, the function will throw if the account could not be created. Alternately, | ||
538 | when `return_detailed_error` is passed, Mastodon.py will return the detailed error | ||
539 | response that the API provides (Starting from version 3.4.0 - not checked here) as an dict with | ||
540 | error details as the second return value and the token returned as `None` in case of error. | ||
541 | The dict will contain a text `error` values as well as a `details` value which is a dict with | ||
542 | one optional key for each potential field (`username`, `password`, `email` and `agreement`), | ||
543 | each if present containing a dict with an `error` category and free text `description`. | ||
544 | Valid error categories are: | ||
545 | |||
546 | * ERR_BLOCKED - When e-mail provider is not allowed | ||
547 | * ERR_UNREACHABLE - When e-mail address does not resolve to any IP via DNS (MX, A, AAAA) | ||
548 | * ERR_TAKEN - When username or e-mail are already taken | ||
549 | * ERR_RESERVED - When a username is reserved, e.g. "webmaster" or "admin" | ||
550 | * ERR_ACCEPTED - When agreement has not been accepted | ||
551 | * ERR_BLANK - When a required attribute is blank | ||
552 | * ERR_INVALID - When an attribute is malformed, e.g. wrong characters or invalid e-mail address | ||
553 | * ERR_TOO_LONG - When an attribute is over the character limit | ||
554 | * ERR_TOO_SHORT - When an attribute is under the character requirement | ||
555 | * ERR_INCLUSION - When an attribute is not one of the allowed values, e.g. unsupported locale | ||
556 | """ | ||
557 | params = self.__generate_params(locals(), ['to_file', 'scopes']) | ||
558 | params['client_id'] = self.client_id | ||
559 | params['client_secret'] = self.client_secret | ||
560 | |||
561 | if not agreement: | ||
562 | del params['agreement'] | ||
563 | 426 | ||
564 | # Step 1: Get a user-free token via oauth | 427 | Returns the version string, possibly including rc info. |
428 | """ | ||
565 | try: | 429 | try: |
566 | oauth_params = {} | 430 | version_str = self.__normalize_version_string(self.__instance()["version"]) |
567 | oauth_params['scope'] = " ".join(scopes) | 431 | self.version_check_worked = True |
568 | oauth_params['client_id'] = self.client_id | 432 | except: |
569 | oauth_params['client_secret'] = self.client_secret | 433 | # instance() was added in 1.1.0, so our best guess is 1.0.0. |
570 | oauth_params['grant_type'] = 'client_credentials' | 434 | version_str = "1.0.0" |
571 | 435 | self.version_check_worked = False | |
572 | response = self.__api_request('POST', '/oauth/token', oauth_params, do_ratelimiting=False) | ||
573 | temp_access_token = response['access_token'] | ||
574 | except Exception as e: | ||
575 | raise MastodonIllegalArgumentError( | ||
576 | 'Invalid request during oauth phase: %s' % e) | ||
577 | 436 | ||
578 | # Step 2: Use that to create a user | 437 | self.mastodon_major, self.mastodon_minor, self.mastodon_patch = parse_version_string(version_str) |
579 | try: | 438 | return version_str |
580 | response = self.__api_request('POST', '/api/v1/accounts', params, do_ratelimiting=False, access_token_override=temp_access_token, skip_error_check=True) | ||
581 | if "error" in response: | ||
582 | if return_detailed_error: | ||
583 | return None, response | ||
584 | raise MastodonIllegalArgumentError('Invalid request: %s' % e) | ||
585 | self.access_token = response['access_token'] | ||
586 | self.__set_refresh_token(response.get('refresh_token')) | ||
587 | self.__set_token_expired(int(response.get('expires_in', 0))) | ||
588 | except Exception as e: | ||
589 | raise MastodonIllegalArgumentError('Invalid request') | ||
590 | 439 | ||
591 | # Step 3: Check scopes, persist, et cetera | 440 | def verify_minimum_version(self, version_str, cached=False): |
592 | received_scopes = response["scope"].split(" ") | 441 | """ |
593 | for scope_set in _SCOPE_SETS.keys(): | 442 | Update version info from server and verify that at least the specified version is present. |
594 | if scope_set in received_scopes: | ||
595 | received_scopes += _SCOPE_SETS[scope_set] | ||
596 | 443 | ||
597 | if not set(scopes) <= set(received_scopes): | 444 | If you specify "cached", the version info update part is skipped. |
598 | raise MastodonAPIError('Granted scopes "' + " ".join(received_scopes) + '" do not contain all of the requested scopes "' + " ".join(scopes) + '".') | ||
599 | 445 | ||
600 | if to_file is not None: | 446 | Returns True if version requirement is satisfied, False if not. |
601 | with open(to_file, 'w') as token_file: | 447 | """ |
602 | token_file.write(response['access_token'] + "\n") | 448 | if not cached: |
603 | token_file.write(self.api_base_url + "\n") | 449 | self.retrieve_mastodon_version() |
450 | major, minor, patch = parse_version_string(version_str) | ||
451 | if major > self.mastodon_major: | ||
452 | return False | ||
453 | elif major == self.mastodon_major and minor > self.mastodon_minor: | ||
454 | return False | ||
455 | elif major == self.mastodon_major and minor == self.mastodon_minor and patch > self.mastodon_patch: | ||
456 | return False | ||
457 | return True | ||
458 | |||
459 | def get_approx_server_time(self): | ||
460 | """ | ||
461 | Retrieve the approximate server time | ||
604 | 462 | ||
605 | self.__logged_in_id = None | 463 | We parse this from the hopefully present "Date" header, but make no effort to compensate for latency. |
464 | """ | ||
465 | response = self.__api_request("HEAD", "/", return_response_object=True) | ||
466 | if 'Date' in response.headers: | ||
467 | server_time_datetime = dateutil.parser.parse(response.headers['Date']) | ||
606 | 468 | ||
607 | if return_detailed_error: | 469 | # Make sure we're in local time |
608 | return response['access_token'], {} | 470 | epoch_time = self.__datetime_to_epoch(server_time_datetime) |
471 | return datetime.datetime.fromtimestamp(epoch_time) | ||
609 | else: | 472 | else: |
610 | return response['access_token'] | 473 | raise MastodonAPIError("No server time in response.") |
611 | 474 | ||
612 | @api_version("3.4.0", "3.4.0", "3.4.0") | 475 | @staticmethod |
613 | def email_resend_confirmation(self): | 476 | def get_supported_version(): |
614 | """ | 477 | """ |
615 | Requests a re-send of the users confirmation mail for an unconfirmed logged in user. | 478 | Retrieve the maximum version of Mastodon supported by this version of Mastodon.py |
616 | |||
617 | Only available to the app that the user originally signed up with. | ||
618 | """ | 479 | """ |
619 | self.__api_request('POST', '/api/v1/emails/confirmations') | 480 | return Mastodon.__SUPPORTED_MASTODON_VERSION |
620 | 481 | ||
621 | ### | 482 | ### |
622 | # Reading data: Instances | 483 | # Reading data: Instances |
623 | ### | 484 | ### |
624 | @api_version("1.1.0", "2.3.0", __DICT_VERSION_INSTANCE) | 485 | @api_version("1.1.0", "2.3.0", _DICT_VERSION_INSTANCE) |
625 | def instance(self): | 486 | def instance(self): |
626 | """ | 487 | """ |
627 | Retrieve basic information about the instance, including the URI and administrative contact email. | 488 | Retrieve basic information about the instance, including the URI and administrative contact email. |
@@ -639,7 +500,7 @@ class Mastodon(Internals): | |||
639 | instance = self.__api_request('GET', '/api/v1/instance/') | 500 | instance = self.__api_request('GET', '/api/v1/instance/') |
640 | return instance | 501 | return instance |
641 | 502 | ||
642 | @api_version("2.1.2", "2.1.2", __DICT_VERSION_ACTIVITY) | 503 | @api_version("2.1.2", "2.1.2", _DICT_VERSION_ACTIVITY) |
643 | def instance_activity(self): | 504 | def instance_activity(self): |
644 | """ | 505 | """ |
645 | Retrieve activity stats about the instance. May be disabled by the instance administrator - throws | 506 | Retrieve activity stats about the instance. May be disabled by the instance administrator - throws |
@@ -698,7 +559,7 @@ class Mastodon(Internals): | |||
698 | parse = urlparse(schema_url) | 559 | parse = urlparse(schema_url) |
699 | return self.__api_request('GET', parse.path + parse.params + parse.query + parse.fragment) | 560 | return self.__api_request('GET', parse.path + parse.params + parse.query + parse.fragment) |
700 | 561 | ||
701 | @api_version("3.4.0", "3.4.0", __DICT_VERSION_INSTANCE) | 562 | @api_version("3.4.0", "3.4.0", _DICT_VERSION_INSTANCE) |
702 | def instance_rules(self): | 563 | def instance_rules(self): |
703 | """ | 564 | """ |
704 | Retrieve instance rules. | 565 | Retrieve instance rules. |
@@ -710,7 +571,7 @@ class Mastodon(Internals): | |||
710 | ### | 571 | ### |
711 | # Reading data: Timelines | 572 | # Reading data: Timelines |
712 | ## | 573 | ## |
713 | @api_version("1.0.0", "3.1.4", __DICT_VERSION_STATUS) | 574 | @api_version("1.0.0", "3.1.4", _DICT_VERSION_STATUS) |
714 | def timeline(self, timeline="home", max_id=None, min_id=None, since_id=None, limit=None, only_media=False, local=False, remote=False): | 575 | def timeline(self, timeline="home", max_id=None, min_id=None, since_id=None, limit=None, only_media=False, local=False, remote=False): |
715 | """ | 576 | """ |
716 | Fetch statuses, most recent ones first. `timeline` can be 'home', 'local', 'public', | 577 | Fetch statuses, most recent ones first. `timeline` can be 'home', 'local', 'public', |
@@ -753,7 +614,7 @@ class Mastodon(Internals): | |||
753 | url = '/api/v1/timelines/{0}'.format(timeline) | 614 | url = '/api/v1/timelines/{0}'.format(timeline) |
754 | return self.__api_request('GET', url, params) | 615 | return self.__api_request('GET', url, params) |
755 | 616 | ||
756 | @api_version("1.0.0", "3.1.4", __DICT_VERSION_STATUS) | 617 | @api_version("1.0.0", "3.1.4", _DICT_VERSION_STATUS) |
757 | def timeline_home(self, max_id=None, min_id=None, since_id=None, limit=None, only_media=False, local=False, remote=False): | 618 | def timeline_home(self, max_id=None, min_id=None, since_id=None, limit=None, only_media=False, local=False, remote=False): |
758 | """ | 619 | """ |
759 | Convenience method: Fetches the logged-in user's home timeline (i.e. followed users and self). Params as in `timeline()`. | 620 | Convenience method: Fetches the logged-in user's home timeline (i.e. followed users and self). Params as in `timeline()`. |
@@ -762,7 +623,7 @@ class Mastodon(Internals): | |||
762 | """ | 623 | """ |
763 | return self.timeline('home', max_id=max_id, min_id=min_id, since_id=since_id, limit=limit, only_media=only_media, local=local, remote=remote) | 624 | return self.timeline('home', max_id=max_id, min_id=min_id, since_id=since_id, limit=limit, only_media=only_media, local=local, remote=remote) |
764 | 625 | ||
765 | @api_version("1.0.0", "3.1.4", __DICT_VERSION_STATUS) | 626 | @api_version("1.0.0", "3.1.4", _DICT_VERSION_STATUS) |
766 | def timeline_local(self, max_id=None, min_id=None, since_id=None, limit=None, only_media=False): | 627 | def timeline_local(self, max_id=None, min_id=None, since_id=None, limit=None, only_media=False): |
767 | """ | 628 | """ |
768 | Convenience method: Fetches the local / instance-wide timeline, not including replies. Params as in `timeline()`. | 629 | Convenience method: Fetches the local / instance-wide timeline, not including replies. Params as in `timeline()`. |
@@ -771,7 +632,7 @@ class Mastodon(Internals): | |||
771 | """ | 632 | """ |
772 | return self.timeline('local', max_id=max_id, min_id=min_id, since_id=since_id, limit=limit, only_media=only_media) | 633 | return self.timeline('local', max_id=max_id, min_id=min_id, since_id=since_id, limit=limit, only_media=only_media) |
773 | 634 | ||
774 | @api_version("1.0.0", "3.1.4", __DICT_VERSION_STATUS) | 635 | @api_version("1.0.0", "3.1.4", _DICT_VERSION_STATUS) |
775 | def timeline_public(self, max_id=None, min_id=None, since_id=None, limit=None, only_media=False, local=False, remote=False): | 636 | def timeline_public(self, max_id=None, min_id=None, since_id=None, limit=None, only_media=False, local=False, remote=False): |
776 | """ | 637 | """ |
777 | Convenience method: Fetches the public / visible-network / federated timeline, not including replies. Params as in `timeline()`. | 638 | Convenience method: Fetches the public / visible-network / federated timeline, not including replies. Params as in `timeline()`. |
@@ -780,7 +641,7 @@ class Mastodon(Internals): | |||
780 | """ | 641 | """ |
781 | return self.timeline('public', max_id=max_id, min_id=min_id, since_id=since_id, limit=limit, only_media=only_media, local=local, remote=remote) | 642 | return self.timeline('public', max_id=max_id, min_id=min_id, since_id=since_id, limit=limit, only_media=only_media, local=local, remote=remote) |
782 | 643 | ||
783 | @api_version("1.0.0", "3.1.4", __DICT_VERSION_STATUS) | 644 | @api_version("1.0.0", "3.1.4", _DICT_VERSION_STATUS) |
784 | def timeline_hashtag(self, hashtag, local=False, max_id=None, min_id=None, since_id=None, limit=None, only_media=False, remote=False): | 645 | def timeline_hashtag(self, hashtag, local=False, max_id=None, min_id=None, since_id=None, limit=None, only_media=False, remote=False): |
785 | """ | 646 | """ |
786 | Convenience method: Fetch a timeline of toots with a given hashtag. The hashtag parameter | 647 | Convenience method: Fetch a timeline of toots with a given hashtag. The hashtag parameter |
@@ -793,7 +654,7 @@ class Mastodon(Internals): | |||
793 | "Hashtag parameter should omit leading #") | 654 | "Hashtag parameter should omit leading #") |
794 | return self.timeline('tag/{0}'.format(hashtag), max_id=max_id, min_id=min_id, since_id=since_id, limit=limit, only_media=only_media, local=local, remote=remote) | 655 | return self.timeline('tag/{0}'.format(hashtag), max_id=max_id, min_id=min_id, since_id=since_id, limit=limit, only_media=only_media, local=local, remote=remote) |
795 | 656 | ||
796 | @api_version("2.1.0", "3.1.4", __DICT_VERSION_STATUS) | 657 | @api_version("2.1.0", "3.1.4", _DICT_VERSION_STATUS) |
797 | def timeline_list(self, id, max_id=None, min_id=None, since_id=None, limit=None, only_media=False, local=False, remote=False): | 658 | def timeline_list(self, id, max_id=None, min_id=None, since_id=None, limit=None, only_media=False, local=False, remote=False): |
798 | """ | 659 | """ |
799 | Convenience method: Fetches a timeline containing all the toots by users in a given list. Params as in `timeline()`. | 660 | Convenience method: Fetches a timeline containing all the toots by users in a given list. Params as in `timeline()`. |
@@ -803,7 +664,7 @@ class Mastodon(Internals): | |||
803 | id = self.__unpack_id(id) | 664 | id = self.__unpack_id(id) |
804 | return self.timeline('list/{0}'.format(id), max_id=max_id, min_id=min_id, since_id=since_id, limit=limit, only_media=only_media, local=local, remote=remote) | 665 | return self.timeline('list/{0}'.format(id), max_id=max_id, min_id=min_id, since_id=since_id, limit=limit, only_media=only_media, local=local, remote=remote) |
805 | 666 | ||
806 | @api_version("2.6.0", "2.6.0", __DICT_VERSION_CONVERSATION) | 667 | @api_version("2.6.0", "2.6.0", _DICT_VERSION_CONVERSATION) |
807 | def conversations(self, max_id=None, min_id=None, since_id=None, limit=None): | 668 | def conversations(self, max_id=None, min_id=None, since_id=None, limit=None): |
808 | """ | 669 | """ |
809 | Fetches a user's conversations. | 670 | Fetches a user's conversations. |
@@ -825,7 +686,7 @@ class Mastodon(Internals): | |||
825 | ### | 686 | ### |
826 | # Reading data: Statuses | 687 | # Reading data: Statuses |
827 | ### | 688 | ### |
828 | @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) | 689 | @api_version("1.0.0", "2.0.0", _DICT_VERSION_STATUS) |
829 | def status(self, id): | 690 | def status(self, id): |
830 | """ | 691 | """ |
831 | Fetch information about a single toot. | 692 | Fetch information about a single toot. |
@@ -838,7 +699,7 @@ class Mastodon(Internals): | |||
838 | url = '/api/v1/statuses/{0}'.format(str(id)) | 699 | url = '/api/v1/statuses/{0}'.format(str(id)) |
839 | return self.__api_request('GET', url) | 700 | return self.__api_request('GET', url) |
840 | 701 | ||
841 | @api_version("1.0.0", "3.0.0", __DICT_VERSION_CARD) | 702 | @api_version("1.0.0", "3.0.0", _DICT_VERSION_CARD) |
842 | def status_card(self, id): | 703 | def status_card(self, id): |
843 | """ | 704 | """ |
844 | Fetch a card associated with a status. A card describes an object (such as an | 705 | Fetch a card associated with a status. A card describes an object (such as an |
@@ -860,7 +721,7 @@ class Mastodon(Internals): | |||
860 | url = '/api/v1/statuses/{0}/card'.format(str(id)) | 721 | url = '/api/v1/statuses/{0}/card'.format(str(id)) |
861 | return self.__api_request('GET', url) | 722 | return self.__api_request('GET', url) |
862 | 723 | ||
863 | @api_version("1.0.0", "1.0.0", __DICT_VERSION_CONTEXT) | 724 | @api_version("1.0.0", "1.0.0", _DICT_VERSION_CONTEXT) |
864 | def status_context(self, id): | 725 | def status_context(self, id): |
865 | """ | 726 | """ |
866 | Fetch information about ancestors and descendants of a toot. | 727 | Fetch information about ancestors and descendants of a toot. |
@@ -873,7 +734,7 @@ class Mastodon(Internals): | |||
873 | url = '/api/v1/statuses/{0}/context'.format(str(id)) | 734 | url = '/api/v1/statuses/{0}/context'.format(str(id)) |
874 | return self.__api_request('GET', url) | 735 | return self.__api_request('GET', url) |
875 | 736 | ||
876 | @api_version("1.0.0", "2.1.0", __DICT_VERSION_ACCOUNT) | 737 | @api_version("1.0.0", "2.1.0", _DICT_VERSION_ACCOUNT) |
877 | def status_reblogged_by(self, id): | 738 | def status_reblogged_by(self, id): |
878 | """ | 739 | """ |
879 | Fetch a list of users that have reblogged a status. | 740 | Fetch a list of users that have reblogged a status. |
@@ -886,7 +747,7 @@ class Mastodon(Internals): | |||
886 | url = '/api/v1/statuses/{0}/reblogged_by'.format(str(id)) | 747 | url = '/api/v1/statuses/{0}/reblogged_by'.format(str(id)) |
887 | return self.__api_request('GET', url) | 748 | return self.__api_request('GET', url) |
888 | 749 | ||
889 | @api_version("1.0.0", "2.1.0", __DICT_VERSION_ACCOUNT) | 750 | @api_version("1.0.0", "2.1.0", _DICT_VERSION_ACCOUNT) |
890 | def status_favourited_by(self, id): | 751 | def status_favourited_by(self, id): |
891 | """ | 752 | """ |
892 | Fetch a list of users that have favourited a status. | 753 | Fetch a list of users that have favourited a status. |
@@ -902,7 +763,7 @@ class Mastodon(Internals): | |||
902 | ### | 763 | ### |
903 | # Reading data: Scheduled statuses | 764 | # Reading data: Scheduled statuses |
904 | ### | 765 | ### |
905 | @api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS) | 766 | @api_version("2.7.0", "2.7.0", _DICT_VERSION_SCHEDULED_STATUS) |
906 | def scheduled_statuses(self): | 767 | def scheduled_statuses(self): |
907 | """ | 768 | """ |
908 | Fetch a list of scheduled statuses | 769 | Fetch a list of scheduled statuses |
@@ -911,7 +772,7 @@ class Mastodon(Internals): | |||
911 | """ | 772 | """ |
912 | return self.__api_request('GET', '/api/v1/scheduled_statuses') | 773 | return self.__api_request('GET', '/api/v1/scheduled_statuses') |
913 | 774 | ||
914 | @api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS) | 775 | @api_version("2.7.0", "2.7.0", _DICT_VERSION_SCHEDULED_STATUS) |
915 | def scheduled_status(self, id): | 776 | def scheduled_status(self, id): |
916 | """ | 777 | """ |
917 | Fetch information about the scheduled status with the given id. | 778 | Fetch information about the scheduled status with the given id. |
@@ -925,7 +786,7 @@ class Mastodon(Internals): | |||
925 | ### | 786 | ### |
926 | # Reading data: Polls | 787 | # Reading data: Polls |
927 | ### | 788 | ### |
928 | @api_version("2.8.0", "2.8.0", __DICT_VERSION_POLL) | 789 | @api_version("2.8.0", "2.8.0", _DICT_VERSION_POLL) |
929 | def poll(self, id): | 790 | def poll(self, id): |
930 | """ | 791 | """ |
931 | Fetch information about the poll with the given id | 792 | Fetch information about the poll with the given id |
@@ -939,7 +800,7 @@ class Mastodon(Internals): | |||
939 | ### | 800 | ### |
940 | # Reading data: Notifications | 801 | # Reading data: Notifications |
941 | ### | 802 | ### |
942 | @api_version("1.0.0", "3.5.0", __DICT_VERSION_NOTIFICATION) | 803 | @api_version("1.0.0", "3.5.0", _DICT_VERSION_NOTIFICATION) |
943 | def notifications(self, id=None, account_id=None, max_id=None, min_id=None, since_id=None, limit=None, exclude_types=None, types=None, mentions_only=None): | 804 | def notifications(self, id=None, account_id=None, max_id=None, min_id=None, since_id=None, limit=None, exclude_types=None, types=None, mentions_only=None): |
944 | """ | 805 | """ |
945 | Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in | 806 | Fetch notifications (mentions, favourites, reblogs, follows) for the logged-in |
@@ -999,7 +860,7 @@ class Mastodon(Internals): | |||
999 | ### | 860 | ### |
1000 | # Reading data: Accounts | 861 | # Reading data: Accounts |
1001 | ### | 862 | ### |
1002 | @api_version("1.0.0", "1.0.0", __DICT_VERSION_ACCOUNT) | 863 | @api_version("1.0.0", "1.0.0", _DICT_VERSION_ACCOUNT) |
1003 | def account(self, id): | 864 | def account(self, id): |
1004 | """ | 865 | """ |
1005 | Fetch account information by user `id`. | 866 | Fetch account information by user `id`. |
@@ -1012,7 +873,7 @@ class Mastodon(Internals): | |||
1012 | url = '/api/v1/accounts/{0}'.format(str(id)) | 873 | url = '/api/v1/accounts/{0}'.format(str(id)) |
1013 | return self.__api_request('GET', url) | 874 | return self.__api_request('GET', url) |
1014 | 875 | ||
1015 | @api_version("1.0.0", "2.1.0", __DICT_VERSION_ACCOUNT) | 876 | @api_version("1.0.0", "2.1.0", _DICT_VERSION_ACCOUNT) |
1016 | def account_verify_credentials(self): | 877 | def account_verify_credentials(self): |
1017 | """ | 878 | """ |
1018 | Fetch logged-in user's account information. | 879 | Fetch logged-in user's account information. |
@@ -1021,7 +882,7 @@ class Mastodon(Internals): | |||
1021 | """ | 882 | """ |
1022 | return self.__api_request('GET', '/api/v1/accounts/verify_credentials') | 883 | return self.__api_request('GET', '/api/v1/accounts/verify_credentials') |
1023 | 884 | ||
1024 | @api_version("1.0.0", "2.1.0", __DICT_VERSION_ACCOUNT) | 885 | @api_version("1.0.0", "2.1.0", _DICT_VERSION_ACCOUNT) |
1025 | def me(self): | 886 | def me(self): |
1026 | """ | 887 | """ |
1027 | Get this user's account. Synonym for `account_verify_credentials()`, does exactly | 888 | Get this user's account. Synonym for `account_verify_credentials()`, does exactly |
@@ -1030,7 +891,7 @@ class Mastodon(Internals): | |||
1030 | """ | 891 | """ |
1031 | return self.account_verify_credentials() | 892 | return self.account_verify_credentials() |
1032 | 893 | ||
1033 | @api_version("1.0.0", "2.8.0", __DICT_VERSION_STATUS) | 894 | @api_version("1.0.0", "2.8.0", _DICT_VERSION_STATUS) |
1034 | def account_statuses(self, id, only_media=False, pinned=False, exclude_replies=False, exclude_reblogs=False, tagged=None, max_id=None, min_id=None, since_id=None, limit=None): | 895 | def account_statuses(self, id, only_media=False, pinned=False, exclude_replies=False, exclude_reblogs=False, tagged=None, max_id=None, min_id=None, since_id=None, limit=None): |
1035 | """ | 896 | """ |
1036 | Fetch statuses by user `id`. Same options as :ref:`timeline() <timeline()>` are permitted. | 897 | Fetch statuses by user `id`. Same options as :ref:`timeline() <timeline()>` are permitted. |
@@ -1073,7 +934,7 @@ class Mastodon(Internals): | |||
1073 | url = '/api/v1/accounts/{0}/statuses'.format(str(id)) | 934 | url = '/api/v1/accounts/{0}/statuses'.format(str(id)) |
1074 | return self.__api_request('GET', url, params) | 935 | return self.__api_request('GET', url, params) |
1075 | 936 | ||
1076 | @api_version("1.0.0", "2.6.0", __DICT_VERSION_ACCOUNT) | 937 | @api_version("1.0.0", "2.6.0", _DICT_VERSION_ACCOUNT) |
1077 | def account_following(self, id, max_id=None, min_id=None, since_id=None, limit=None): | 938 | def account_following(self, id, max_id=None, min_id=None, since_id=None, limit=None): |
1078 | """ | 939 | """ |
1079 | Fetch users the given user is following. | 940 | Fetch users the given user is following. |
@@ -1094,7 +955,7 @@ class Mastodon(Internals): | |||
1094 | url = '/api/v1/accounts/{0}/following'.format(str(id)) | 955 | url = '/api/v1/accounts/{0}/following'.format(str(id)) |
1095 | return self.__api_request('GET', url, params) | 956 | return self.__api_request('GET', url, params) |
1096 | 957 | ||
1097 | @api_version("1.0.0", "2.6.0", __DICT_VERSION_ACCOUNT) | 958 | @api_version("1.0.0", "2.6.0", _DICT_VERSION_ACCOUNT) |
1098 | def account_followers(self, id, max_id=None, min_id=None, since_id=None, limit=None): | 959 | def account_followers(self, id, max_id=None, min_id=None, since_id=None, limit=None): |
1099 | """ | 960 | """ |
1100 | Fetch users the given user is followed by. | 961 | Fetch users the given user is followed by. |
@@ -1115,7 +976,7 @@ class Mastodon(Internals): | |||
1115 | url = '/api/v1/accounts/{0}/followers'.format(str(id)) | 976 | url = '/api/v1/accounts/{0}/followers'.format(str(id)) |
1116 | return self.__api_request('GET', url, params) | 977 | return self.__api_request('GET', url, params) |
1117 | 978 | ||
1118 | @api_version("1.0.0", "1.4.0", __DICT_VERSION_RELATIONSHIP) | 979 | @api_version("1.0.0", "1.4.0", _DICT_VERSION_RELATIONSHIP) |
1119 | def account_relationships(self, id): | 980 | def account_relationships(self, id): |
1120 | """ | 981 | """ |
1121 | Fetch relationship (following, followed_by, blocking, follow requested) of | 982 | Fetch relationship (following, followed_by, blocking, follow requested) of |
@@ -1128,7 +989,7 @@ class Mastodon(Internals): | |||
1128 | return self.__api_request('GET', '/api/v1/accounts/relationships', | 989 | return self.__api_request('GET', '/api/v1/accounts/relationships', |
1129 | params) | 990 | params) |
1130 | 991 | ||
1131 | @api_version("1.0.0", "2.3.0", __DICT_VERSION_ACCOUNT) | 992 | @api_version("1.0.0", "2.3.0", _DICT_VERSION_ACCOUNT) |
1132 | def account_search(self, q, limit=None, following=False): | 993 | def account_search(self, q, limit=None, following=False): |
1133 | """ | 994 | """ |
1134 | Fetch matching accounts. Will lookup an account remotely if the search term is | 995 | Fetch matching accounts. Will lookup an account remotely if the search term is |
@@ -1144,7 +1005,7 @@ class Mastodon(Internals): | |||
1144 | 1005 | ||
1145 | return self.__api_request('GET', '/api/v1/accounts/search', params) | 1006 | return self.__api_request('GET', '/api/v1/accounts/search', params) |
1146 | 1007 | ||
1147 | @api_version("2.1.0", "2.1.0", __DICT_VERSION_LIST) | 1008 | @api_version("2.1.0", "2.1.0", _DICT_VERSION_LIST) |
1148 | def account_lists(self, id): | 1009 | def account_lists(self, id): |
1149 | """ | 1010 | """ |
1150 | Get all of the logged-in user's lists which the specified user is | 1011 | Get all of the logged-in user's lists which the specified user is |
@@ -1157,7 +1018,7 @@ class Mastodon(Internals): | |||
1157 | url = '/api/v1/accounts/{0}/lists'.format(str(id)) | 1018 | url = '/api/v1/accounts/{0}/lists'.format(str(id)) |
1158 | return self.__api_request('GET', url, params) | 1019 | return self.__api_request('GET', url, params) |
1159 | 1020 | ||
1160 | @api_version("3.4.0", "3.4.0", __DICT_VERSION_ACCOUNT) | 1021 | @api_version("3.4.0", "3.4.0", _DICT_VERSION_ACCOUNT) |
1161 | def account_lookup(self, acct): | 1022 | def account_lookup(self, acct): |
1162 | """ | 1023 | """ |
1163 | Look up an account from user@instance form (@instance allowed but not required for | 1024 | Look up an account from user@instance form (@instance allowed but not required for |
@@ -1169,7 +1030,7 @@ class Mastodon(Internals): | |||
1169 | """ | 1030 | """ |
1170 | return self.__api_request('GET', '/api/v1/accounts/lookup', self.__generate_params(locals())) | 1031 | return self.__api_request('GET', '/api/v1/accounts/lookup', self.__generate_params(locals())) |
1171 | 1032 | ||
1172 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_FAMILIAR_FOLLOWERS) | 1033 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_FAMILIAR_FOLLOWERS) |
1173 | def account_familiar_followers(self, id): | 1034 | def account_familiar_followers(self, id): |
1174 | """ | 1035 | """ |
1175 | Find followers for the account given by id (can be a list) that also follow the | 1036 | Find followers for the account given by id (can be a list) that also follow the |
@@ -1186,7 +1047,7 @@ class Mastodon(Internals): | |||
1186 | ### | 1047 | ### |
1187 | # Reading data: Featured hashtags | 1048 | # Reading data: Featured hashtags |
1188 | ### | 1049 | ### |
1189 | @api_version("3.0.0", "3.0.0", __DICT_VERSION_FEATURED_TAG) | 1050 | @api_version("3.0.0", "3.0.0", _DICT_VERSION_FEATURED_TAG) |
1190 | def featured_tags(self): | 1051 | def featured_tags(self): |
1191 | """ | 1052 | """ |
1192 | Return the hashtags the logged-in user has set to be featured on | 1053 | Return the hashtags the logged-in user has set to be featured on |
@@ -1196,7 +1057,7 @@ class Mastodon(Internals): | |||
1196 | """ | 1057 | """ |
1197 | return self.__api_request('GET', '/api/v1/featured_tags') | 1058 | return self.__api_request('GET', '/api/v1/featured_tags') |
1198 | 1059 | ||
1199 | @api_version("3.0.0", "3.0.0", __DICT_VERSION_HASHTAG) | 1060 | @api_version("3.0.0", "3.0.0", _DICT_VERSION_HASHTAG) |
1200 | def featured_tag_suggestions(self): | 1061 | def featured_tag_suggestions(self): |
1201 | """ | 1062 | """ |
1202 | Returns the logged-in user's 10 most commonly-used hashtags. | 1063 | Returns the logged-in user's 10 most commonly-used hashtags. |
@@ -1208,7 +1069,7 @@ class Mastodon(Internals): | |||
1208 | ### | 1069 | ### |
1209 | # Reading data: Keyword filters | 1070 | # Reading data: Keyword filters |
1210 | ### | 1071 | ### |
1211 | @api_version("2.4.3", "2.4.3", __DICT_VERSION_FILTER) | 1072 | @api_version("2.4.3", "2.4.3", _DICT_VERSION_FILTER) |
1212 | def filters(self): | 1073 | def filters(self): |
1213 | """ | 1074 | """ |
1214 | Fetch all of the logged-in user's filters. | 1075 | Fetch all of the logged-in user's filters. |
@@ -1217,7 +1078,7 @@ class Mastodon(Internals): | |||
1217 | """ | 1078 | """ |
1218 | return self.__api_request('GET', '/api/v1/filters') | 1079 | return self.__api_request('GET', '/api/v1/filters') |
1219 | 1080 | ||
1220 | @api_version("2.4.3", "2.4.3", __DICT_VERSION_FILTER) | 1081 | @api_version("2.4.3", "2.4.3", _DICT_VERSION_FILTER) |
1221 | def filter(self, id): | 1082 | def filter(self, id): |
1222 | """ | 1083 | """ |
1223 | Fetches information about the filter with the specified `id`. | 1084 | Fetches information about the filter with the specified `id`. |
@@ -1228,7 +1089,7 @@ class Mastodon(Internals): | |||
1228 | url = '/api/v1/filters/{0}'.format(str(id)) | 1089 | url = '/api/v1/filters/{0}'.format(str(id)) |
1229 | return self.__api_request('GET', url) | 1090 | return self.__api_request('GET', url) |
1230 | 1091 | ||
1231 | @api_version("2.4.3", "2.4.3", __DICT_VERSION_FILTER) | 1092 | @api_version("2.4.3", "2.4.3", _DICT_VERSION_FILTER) |
1232 | def filters_apply(self, objects, filters, context): | 1093 | def filters_apply(self, objects, filters, context): |
1233 | """ | 1094 | """ |
1234 | Helper function: Applies a list of filters to a list of either statuses | 1095 | Helper function: Applies a list of filters to a list of either statuses |
@@ -1266,7 +1127,7 @@ class Mastodon(Internals): | |||
1266 | ### | 1127 | ### |
1267 | # Reading data: Follow suggestions | 1128 | # Reading data: Follow suggestions |
1268 | ### | 1129 | ### |
1269 | @api_version("2.4.3", "2.4.3", __DICT_VERSION_ACCOUNT) | 1130 | @api_version("2.4.3", "2.4.3", _DICT_VERSION_ACCOUNT) |
1270 | def suggestions(self): | 1131 | def suggestions(self): |
1271 | """ | 1132 | """ |
1272 | Fetch follow suggestions for the logged-in user. | 1133 | Fetch follow suggestions for the logged-in user. |
@@ -1279,7 +1140,7 @@ class Mastodon(Internals): | |||
1279 | ### | 1140 | ### |
1280 | # Reading data: Follow suggestions | 1141 | # Reading data: Follow suggestions |
1281 | ### | 1142 | ### |
1282 | @api_version("3.0.0", "3.0.0", __DICT_VERSION_ACCOUNT) | 1143 | @api_version("3.0.0", "3.0.0", _DICT_VERSION_ACCOUNT) |
1283 | def directory(self, offset=None, limit=None, order=None, local=None): | 1144 | def directory(self, offset=None, limit=None, order=None, local=None): |
1284 | """ | 1145 | """ |
1285 | Fetch the contents of the profile directory, if enabled on the server. | 1146 | Fetch the contents of the profile directory, if enabled on the server. |
@@ -1302,7 +1163,7 @@ class Mastodon(Internals): | |||
1302 | ### | 1163 | ### |
1303 | # Reading data: Endorsements | 1164 | # Reading data: Endorsements |
1304 | ### | 1165 | ### |
1305 | @api_version("2.5.0", "2.5.0", __DICT_VERSION_ACCOUNT) | 1166 | @api_version("2.5.0", "2.5.0", _DICT_VERSION_ACCOUNT) |
1306 | def endorsements(self): | 1167 | def endorsements(self): |
1307 | """ | 1168 | """ |
1308 | Fetch list of users endorsed by the logged-in user. | 1169 | Fetch list of users endorsed by the logged-in user. |
@@ -1325,7 +1186,7 @@ class Mastodon(Internals): | |||
1325 | if not self.verify_minimum_version("2.8.0", cached=True): | 1186 | if not self.verify_minimum_version("2.8.0", cached=True): |
1326 | raise MastodonVersionError("Advanced search parameters require Mastodon 2.8.0+") | 1187 | raise MastodonVersionError("Advanced search parameters require Mastodon 2.8.0+") |
1327 | 1188 | ||
1328 | @api_version("1.1.0", "2.8.0", __DICT_VERSION_SEARCHRESULT) | 1189 | @api_version("1.1.0", "2.8.0", _DICT_VERSION_SEARCHRESULT) |
1329 | def search(self, q, resolve=True, result_type=None, account_id=None, offset=None, min_id=None, max_id=None, exclude_unreviewed=True): | 1190 | def search(self, q, resolve=True, result_type=None, account_id=None, offset=None, min_id=None, max_id=None, exclude_unreviewed=True): |
1330 | """ | 1191 | """ |
1331 | Fetch matching hashtags, accounts and statuses. Will perform webfinger | 1192 | Fetch matching hashtags, accounts and statuses. Will perform webfinger |
@@ -1372,7 +1233,7 @@ class Mastodon(Internals): | |||
1372 | del params['resolve'] | 1233 | del params['resolve'] |
1373 | return self.__api_request('GET', '/api/v1/search', params) | 1234 | return self.__api_request('GET', '/api/v1/search', params) |
1374 | 1235 | ||
1375 | @api_version("2.4.1", "2.8.0", __DICT_VERSION_SEARCHRESULT) | 1236 | @api_version("2.4.1", "2.8.0", _DICT_VERSION_SEARCHRESULT) |
1376 | def search_v2(self, q, resolve=True, result_type=None, account_id=None, offset=None, min_id=None, max_id=None, exclude_unreviewed=True): | 1237 | def search_v2(self, q, resolve=True, result_type=None, account_id=None, offset=None, min_id=None, max_id=None, exclude_unreviewed=True): |
1377 | """ | 1238 | """ |
1378 | Identical to `search_v1()`, except in that it returns tags as | 1239 | Identical to `search_v1()`, except in that it returns tags as |
@@ -1401,14 +1262,14 @@ class Mastodon(Internals): | |||
1401 | ### | 1262 | ### |
1402 | # Reading data: Trends | 1263 | # Reading data: Trends |
1403 | ### | 1264 | ### |
1404 | @api_version("2.4.3", "3.5.0", __DICT_VERSION_HASHTAG) | 1265 | @api_version("2.4.3", "3.5.0", _DICT_VERSION_HASHTAG) |
1405 | def trends(self, limit=None): | 1266 | def trends(self, limit=None): |
1406 | """ | 1267 | """ |
1407 | Alias for :ref:`trending_tags() <trending_tags()>` | 1268 | Alias for :ref:`trending_tags() <trending_tags()>` |
1408 | """ | 1269 | """ |
1409 | return self.trending_tags(limit=limit) | 1270 | return self.trending_tags(limit=limit) |
1410 | 1271 | ||
1411 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_HASHTAG) | 1272 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_HASHTAG) |
1412 | def trending_tags(self, limit=None, lang=None): | 1273 | def trending_tags(self, limit=None, lang=None): |
1413 | """ | 1274 | """ |
1414 | Fetch trending-hashtag information, if the instance provides such information. | 1275 | Fetch trending-hashtag information, if the instance provides such information. |
@@ -1433,7 +1294,7 @@ class Mastodon(Internals): | |||
1433 | else: | 1294 | else: |
1434 | return self.__api_request('GET', '/api/v1/trends', params) | 1295 | return self.__api_request('GET', '/api/v1/trends', params) |
1435 | 1296 | ||
1436 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_STATUS) | 1297 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_STATUS) |
1437 | def trending_statuses(self): | 1298 | def trending_statuses(self): |
1438 | """ | 1299 | """ |
1439 | Fetch trending-status information, if the instance provides such information. | 1300 | Fetch trending-status information, if the instance provides such information. |
@@ -1449,7 +1310,7 @@ class Mastodon(Internals): | |||
1449 | params = self.__generate_params(locals()) | 1310 | params = self.__generate_params(locals()) |
1450 | return self.__api_request('GET', '/api/v1/trends/statuses', params) | 1311 | return self.__api_request('GET', '/api/v1/trends/statuses', params) |
1451 | 1312 | ||
1452 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_CARD) | 1313 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_CARD) |
1453 | def trending_links(self): | 1314 | def trending_links(self): |
1454 | """ | 1315 | """ |
1455 | Fetch trending-link information, if the instance provides such information. | 1316 | Fetch trending-link information, if the instance provides such information. |
@@ -1466,7 +1327,7 @@ class Mastodon(Internals): | |||
1466 | ### | 1327 | ### |
1467 | # Reading data: Lists | 1328 | # Reading data: Lists |
1468 | ### | 1329 | ### |
1469 | @api_version("2.1.0", "2.1.0", __DICT_VERSION_LIST) | 1330 | @api_version("2.1.0", "2.1.0", _DICT_VERSION_LIST) |
1470 | def lists(self): | 1331 | def lists(self): |
1471 | """ | 1332 | """ |
1472 | Fetch a list of all the Lists by the logged-in user. | 1333 | Fetch a list of all the Lists by the logged-in user. |
@@ -1475,7 +1336,7 @@ class Mastodon(Internals): | |||
1475 | """ | 1336 | """ |
1476 | return self.__api_request('GET', '/api/v1/lists') | 1337 | return self.__api_request('GET', '/api/v1/lists') |
1477 | 1338 | ||
1478 | @api_version("2.1.0", "2.1.0", __DICT_VERSION_LIST) | 1339 | @api_version("2.1.0", "2.1.0", _DICT_VERSION_LIST) |
1479 | def list(self, id): | 1340 | def list(self, id): |
1480 | """ | 1341 | """ |
1481 | Fetch info about a specific list. | 1342 | Fetch info about a specific list. |
@@ -1485,7 +1346,7 @@ class Mastodon(Internals): | |||
1485 | id = self.__unpack_id(id) | 1346 | id = self.__unpack_id(id) |
1486 | return self.__api_request('GET', '/api/v1/lists/{0}'.format(id)) | 1347 | return self.__api_request('GET', '/api/v1/lists/{0}'.format(id)) |
1487 | 1348 | ||
1488 | @api_version("2.1.0", "2.6.0", __DICT_VERSION_ACCOUNT) | 1349 | @api_version("2.1.0", "2.6.0", _DICT_VERSION_ACCOUNT) |
1489 | def list_accounts(self, id, max_id=None, min_id=None, since_id=None, limit=None): | 1350 | def list_accounts(self, id, max_id=None, min_id=None, since_id=None, limit=None): |
1490 | """ | 1351 | """ |
1491 | Get the accounts that are on the given list. | 1352 | Get the accounts that are on the given list. |
@@ -1509,7 +1370,7 @@ class Mastodon(Internals): | |||
1509 | ### | 1370 | ### |
1510 | # Reading data: Mutes and Blocks | 1371 | # Reading data: Mutes and Blocks |
1511 | ### | 1372 | ### |
1512 | @api_version("1.1.0", "2.6.0", __DICT_VERSION_ACCOUNT) | 1373 | @api_version("1.1.0", "2.6.0", _DICT_VERSION_ACCOUNT) |
1513 | def mutes(self, max_id=None, min_id=None, since_id=None, limit=None): | 1374 | def mutes(self, max_id=None, min_id=None, since_id=None, limit=None): |
1514 | """ | 1375 | """ |
1515 | Fetch a list of users muted by the logged-in user. | 1376 | Fetch a list of users muted by the logged-in user. |
@@ -1528,7 +1389,7 @@ class Mastodon(Internals): | |||
1528 | params = self.__generate_params(locals()) | 1389 | params = self.__generate_params(locals()) |
1529 | return self.__api_request('GET', '/api/v1/mutes', params) | 1390 | return self.__api_request('GET', '/api/v1/mutes', params) |
1530 | 1391 | ||
1531 | @api_version("1.0.0", "2.6.0", __DICT_VERSION_ACCOUNT) | 1392 | @api_version("1.0.0", "2.6.0", _DICT_VERSION_ACCOUNT) |
1532 | def blocks(self, max_id=None, min_id=None, since_id=None, limit=None): | 1393 | def blocks(self, max_id=None, min_id=None, since_id=None, limit=None): |
1533 | """ | 1394 | """ |
1534 | Fetch a list of users blocked by the logged-in user. | 1395 | Fetch a list of users blocked by the logged-in user. |
@@ -1550,7 +1411,7 @@ class Mastodon(Internals): | |||
1550 | ### | 1411 | ### |
1551 | # Reading data: Reports | 1412 | # Reading data: Reports |
1552 | ### | 1413 | ### |
1553 | @api_version("1.1.0", "1.1.0", __DICT_VERSION_REPORT) | 1414 | @api_version("1.1.0", "1.1.0", _DICT_VERSION_REPORT) |
1554 | def reports(self): | 1415 | def reports(self): |
1555 | """ | 1416 | """ |
1556 | Fetch a list of reports made by the logged-in user. | 1417 | Fetch a list of reports made by the logged-in user. |
@@ -1567,7 +1428,7 @@ class Mastodon(Internals): | |||
1567 | ### | 1428 | ### |
1568 | # Reading data: Favourites | 1429 | # Reading data: Favourites |
1569 | ### | 1430 | ### |
1570 | @api_version("1.0.0", "2.6.0", __DICT_VERSION_STATUS) | 1431 | @api_version("1.0.0", "2.6.0", _DICT_VERSION_STATUS) |
1571 | def favourites(self, max_id=None, min_id=None, since_id=None, limit=None): | 1432 | def favourites(self, max_id=None, min_id=None, since_id=None, limit=None): |
1572 | """ | 1433 | """ |
1573 | Fetch the logged-in user's favourited statuses. | 1434 | Fetch the logged-in user's favourited statuses. |
@@ -1589,7 +1450,7 @@ class Mastodon(Internals): | |||
1589 | ### | 1450 | ### |
1590 | # Reading data: Follow requests | 1451 | # Reading data: Follow requests |
1591 | ### | 1452 | ### |
1592 | @api_version("1.0.0", "2.6.0", __DICT_VERSION_ACCOUNT) | 1453 | @api_version("1.0.0", "2.6.0", _DICT_VERSION_ACCOUNT) |
1593 | def follow_requests(self, max_id=None, min_id=None, since_id=None, limit=None): | 1454 | def follow_requests(self, max_id=None, min_id=None, since_id=None, limit=None): |
1594 | """ | 1455 | """ |
1595 | Fetch the logged-in user's incoming follow requests. | 1456 | Fetch the logged-in user's incoming follow requests. |
@@ -1633,7 +1494,7 @@ class Mastodon(Internals): | |||
1633 | ### | 1494 | ### |
1634 | # Reading data: Emoji | 1495 | # Reading data: Emoji |
1635 | ### | 1496 | ### |
1636 | @api_version("2.1.0", "2.1.0", __DICT_VERSION_EMOJI) | 1497 | @api_version("2.1.0", "2.1.0", _DICT_VERSION_EMOJI) |
1637 | def custom_emojis(self): | 1498 | def custom_emojis(self): |
1638 | """ | 1499 | """ |
1639 | Fetch the list of custom emoji the instance has installed. | 1500 | Fetch the list of custom emoji the instance has installed. |
@@ -1647,7 +1508,7 @@ class Mastodon(Internals): | |||
1647 | ### | 1508 | ### |
1648 | # Reading data: Apps | 1509 | # Reading data: Apps |
1649 | ### | 1510 | ### |
1650 | @api_version("2.0.0", "2.7.2", __DICT_VERSION_APPLICATION) | 1511 | @api_version("2.0.0", "2.7.2", _DICT_VERSION_APPLICATION) |
1651 | def app_verify_credentials(self): | 1512 | def app_verify_credentials(self): |
1652 | """ | 1513 | """ |
1653 | Fetch information about the current application. | 1514 | Fetch information about the current application. |
@@ -1659,7 +1520,7 @@ class Mastodon(Internals): | |||
1659 | ### | 1520 | ### |
1660 | # Reading data: Webpush subscriptions | 1521 | # Reading data: Webpush subscriptions |
1661 | ### | 1522 | ### |
1662 | @api_version("2.4.0", "2.4.0", __DICT_VERSION_PUSH) | 1523 | @api_version("2.4.0", "2.4.0", _DICT_VERSION_PUSH) |
1663 | def push_subscription(self): | 1524 | def push_subscription(self): |
1664 | """ | 1525 | """ |
1665 | Fetch the current push subscription the logged-in user has for this app. | 1526 | Fetch the current push subscription the logged-in user has for this app. |
@@ -1671,7 +1532,7 @@ class Mastodon(Internals): | |||
1671 | ### | 1532 | ### |
1672 | # Reading data: Preferences | 1533 | # Reading data: Preferences |
1673 | ### | 1534 | ### |
1674 | @api_version("2.8.0", "2.8.0", __DICT_VERSION_PREFERENCES) | 1535 | @api_version("2.8.0", "2.8.0", _DICT_VERSION_PREFERENCES) |
1675 | def preferences(self): | 1536 | def preferences(self): |
1676 | """ | 1537 | """ |
1677 | Fetch the user's preferences, which can be used to set some default options. | 1538 | Fetch the user's preferences, which can be used to set some default options. |
@@ -1686,7 +1547,7 @@ class Mastodon(Internals): | |||
1686 | ## | 1547 | ## |
1687 | 1548 | ||
1688 | # /api/v1/announcements | 1549 | # /api/v1/announcements |
1689 | @api_version("3.1.0", "3.1.0", __DICT_VERSION_ANNOUNCEMENT) | 1550 | @api_version("3.1.0", "3.1.0", _DICT_VERSION_ANNOUNCEMENT) |
1690 | def announcements(self): | 1551 | def announcements(self): |
1691 | """ | 1552 | """ |
1692 | Fetch currently active announcements. | 1553 | Fetch currently active announcements. |
@@ -1698,7 +1559,7 @@ class Mastodon(Internals): | |||
1698 | ## | 1559 | ## |
1699 | # Reading data: Read markers | 1560 | # Reading data: Read markers |
1700 | ## | 1561 | ## |
1701 | @api_version("3.0.0", "3.0.0", __DICT_VERSION_MARKER) | 1562 | @api_version("3.0.0", "3.0.0", _DICT_VERSION_MARKER) |
1702 | def markers_get(self, timeline=["home"]): | 1563 | def markers_get(self, timeline=["home"]): |
1703 | """ | 1564 | """ |
1704 | Get the last-read-location markers for the specified timelines. Valid timelines | 1565 | Get the last-read-location markers for the specified timelines. Valid timelines |
@@ -1717,7 +1578,7 @@ class Mastodon(Internals): | |||
1717 | ### | 1578 | ### |
1718 | # Reading data: Bookmarks | 1579 | # Reading data: Bookmarks |
1719 | ### | 1580 | ### |
1720 | @api_version("3.1.0", "3.1.0", __DICT_VERSION_STATUS) | 1581 | @api_version("3.1.0", "3.1.0", _DICT_VERSION_STATUS) |
1721 | def bookmarks(self, max_id=None, min_id=None, since_id=None, limit=None): | 1582 | def bookmarks(self, max_id=None, min_id=None, since_id=None, limit=None): |
1722 | """ | 1583 | """ |
1723 | Get a list of statuses bookmarked by the logged-in user. | 1584 | Get a list of statuses bookmarked by the logged-in user. |
@@ -1815,7 +1676,7 @@ class Mastodon(Internals): | |||
1815 | # Edit | 1676 | # Edit |
1816 | return self.__api_request('PUT', '/api/v1/statuses/{0}'.format(str(self.__unpack_id(edit))), params, headers=headers, use_json=use_json) | 1677 | return self.__api_request('PUT', '/api/v1/statuses/{0}'.format(str(self.__unpack_id(edit))), params, headers=headers, use_json=use_json) |
1817 | 1678 | ||
1818 | @api_version("1.0.0", "2.8.0", __DICT_VERSION_STATUS) | 1679 | @api_version("1.0.0", "2.8.0", _DICT_VERSION_STATUS) |
1819 | def status_post(self, status, in_reply_to_id=None, media_ids=None, | 1680 | def status_post(self, status, in_reply_to_id=None, media_ids=None, |
1820 | sensitive=False, visibility=None, spoiler_text=None, | 1681 | sensitive=False, visibility=None, spoiler_text=None, |
1821 | language=None, idempotency_key=None, content_type=None, | 1682 | language=None, idempotency_key=None, content_type=None, |
@@ -1892,7 +1753,7 @@ class Mastodon(Internals): | |||
1892 | edit=None | 1753 | edit=None |
1893 | ) | 1754 | ) |
1894 | 1755 | ||
1895 | @api_version("1.0.0", "2.8.0", __DICT_VERSION_STATUS) | 1756 | @api_version("1.0.0", "2.8.0", _DICT_VERSION_STATUS) |
1896 | def toot(self, status): | 1757 | def toot(self, status): |
1897 | """ | 1758 | """ |
1898 | Synonym for :ref:`status_post() <status_post()>` that only takes the status text as input. | 1759 | Synonym for :ref:`status_post() <status_post()>` that only takes the status text as input. |
@@ -1903,7 +1764,7 @@ class Mastodon(Internals): | |||
1903 | """ | 1764 | """ |
1904 | return self.status_post(status) | 1765 | return self.status_post(status) |
1905 | 1766 | ||
1906 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_STATUS) | 1767 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_STATUS) |
1907 | def status_update(self, id, status = None, spoiler_text = None, sensitive = None, media_ids = None, poll = None): | 1768 | def status_update(self, id, status = None, spoiler_text = None, sensitive = None, media_ids = None, poll = None): |
1908 | """ | 1769 | """ |
1909 | Edit a status. The meanings of the fields are largely the same as in :ref:`status_post() <status_post()>`, | 1770 | Edit a status. The meanings of the fields are largely the same as in :ref:`status_post() <status_post()>`, |
@@ -1920,7 +1781,7 @@ class Mastodon(Internals): | |||
1920 | edit = id | 1781 | edit = id |
1921 | ) | 1782 | ) |
1922 | 1783 | ||
1923 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_STATUS_EDIT) | 1784 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_STATUS_EDIT) |
1924 | def status_history(self, id): | 1785 | def status_history(self, id): |
1925 | """ | 1786 | """ |
1926 | Returns the edit history of a status as a list of :ref:`status edit dicts <status edit dicts>`, starting | 1787 | Returns the edit history of a status as a list of :ref:`status edit dicts <status edit dicts>`, starting |
@@ -1942,7 +1803,7 @@ class Mastodon(Internals): | |||
1942 | id = self.__unpack_id(id) | 1803 | id = self.__unpack_id(id) |
1943 | return self.__api_request('GET', "/api/v1/statuses/{0}/source".format(str(id))) | 1804 | return self.__api_request('GET', "/api/v1/statuses/{0}/source".format(str(id))) |
1944 | 1805 | ||
1945 | @api_version("1.0.0", "2.8.0", __DICT_VERSION_STATUS) | 1806 | @api_version("1.0.0", "2.8.0", _DICT_VERSION_STATUS) |
1946 | def status_reply(self, to_status, status, in_reply_to_id=None, media_ids=None, | 1807 | def status_reply(self, to_status, status, in_reply_to_id=None, media_ids=None, |
1947 | sensitive=False, visibility=None, spoiler_text=None, | 1808 | sensitive=False, visibility=None, spoiler_text=None, |
1948 | language=None, idempotency_key=None, content_type=None, | 1809 | language=None, idempotency_key=None, content_type=None, |
@@ -1988,7 +1849,7 @@ class Mastodon(Internals): | |||
1988 | keyword_args["in_reply_to_id"] = to_status.id | 1849 | keyword_args["in_reply_to_id"] = to_status.id |
1989 | return self.status_post(**keyword_args) | 1850 | return self.status_post(**keyword_args) |
1990 | 1851 | ||
1991 | @api_version("2.8.0", "2.8.0", __DICT_VERSION_POLL) | 1852 | @api_version("2.8.0", "2.8.0", _DICT_VERSION_POLL) |
1992 | def make_poll(self, options, expires_in, multiple=False, hide_totals=False): | 1853 | def make_poll(self, options, expires_in, multiple=False, hide_totals=False): |
1993 | """ | 1854 | """ |
1994 | Generate a poll object that can be passed as the `poll` option when posting a status. | 1855 | Generate a poll object that can be passed as the `poll` option when posting a status. |
@@ -2015,7 +1876,7 @@ class Mastodon(Internals): | |||
2015 | url = '/api/v1/statuses/{0}'.format(str(id)) | 1876 | url = '/api/v1/statuses/{0}'.format(str(id)) |
2016 | return self.__api_request('DELETE', url) | 1877 | return self.__api_request('DELETE', url) |
2017 | 1878 | ||
2018 | @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) | 1879 | @api_version("1.0.0", "2.0.0", _DICT_VERSION_STATUS) |
2019 | def status_reblog(self, id, visibility=None): | 1880 | def status_reblog(self, id, visibility=None): |
2020 | """ | 1881 | """ |
2021 | Reblog / boost a status. | 1882 | Reblog / boost a status. |
@@ -2037,7 +1898,7 @@ class Mastodon(Internals): | |||
2037 | url = '/api/v1/statuses/{0}/reblog'.format(str(id)) | 1898 | url = '/api/v1/statuses/{0}/reblog'.format(str(id)) |
2038 | return self.__api_request('POST', url, params) | 1899 | return self.__api_request('POST', url, params) |
2039 | 1900 | ||
2040 | @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) | 1901 | @api_version("1.0.0", "2.0.0", _DICT_VERSION_STATUS) |
2041 | def status_unreblog(self, id): | 1902 | def status_unreblog(self, id): |
2042 | """ | 1903 | """ |
2043 | Un-reblog a status. | 1904 | Un-reblog a status. |
@@ -2048,7 +1909,7 @@ class Mastodon(Internals): | |||
2048 | url = '/api/v1/statuses/{0}/unreblog'.format(str(id)) | 1909 | url = '/api/v1/statuses/{0}/unreblog'.format(str(id)) |
2049 | return self.__api_request('POST', url) | 1910 | return self.__api_request('POST', url) |
2050 | 1911 | ||
2051 | @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) | 1912 | @api_version("1.0.0", "2.0.0", _DICT_VERSION_STATUS) |
2052 | def status_favourite(self, id): | 1913 | def status_favourite(self, id): |
2053 | """ | 1914 | """ |
2054 | Favourite a status. | 1915 | Favourite a status. |
@@ -2059,7 +1920,7 @@ class Mastodon(Internals): | |||
2059 | url = '/api/v1/statuses/{0}/favourite'.format(str(id)) | 1920 | url = '/api/v1/statuses/{0}/favourite'.format(str(id)) |
2060 | return self.__api_request('POST', url) | 1921 | return self.__api_request('POST', url) |
2061 | 1922 | ||
2062 | @api_version("1.0.0", "2.0.0", __DICT_VERSION_STATUS) | 1923 | @api_version("1.0.0", "2.0.0", _DICT_VERSION_STATUS) |
2063 | def status_unfavourite(self, id): | 1924 | def status_unfavourite(self, id): |
2064 | """ | 1925 | """ |
2065 | Un-favourite a status. | 1926 | Un-favourite a status. |
@@ -2070,7 +1931,7 @@ class Mastodon(Internals): | |||
2070 | url = '/api/v1/statuses/{0}/unfavourite'.format(str(id)) | 1931 | url = '/api/v1/statuses/{0}/unfavourite'.format(str(id)) |
2071 | return self.__api_request('POST', url) | 1932 | return self.__api_request('POST', url) |
2072 | 1933 | ||
2073 | @api_version("1.4.0", "2.0.0", __DICT_VERSION_STATUS) | 1934 | @api_version("1.4.0", "2.0.0", _DICT_VERSION_STATUS) |
2074 | def status_mute(self, id): | 1935 | def status_mute(self, id): |
2075 | """ | 1936 | """ |
2076 | Mute notifications for a status. | 1937 | Mute notifications for a status. |
@@ -2081,7 +1942,7 @@ class Mastodon(Internals): | |||
2081 | url = '/api/v1/statuses/{0}/mute'.format(str(id)) | 1942 | url = '/api/v1/statuses/{0}/mute'.format(str(id)) |
2082 | return self.__api_request('POST', url) | 1943 | return self.__api_request('POST', url) |
2083 | 1944 | ||
2084 | @api_version("1.4.0", "2.0.0", __DICT_VERSION_STATUS) | 1945 | @api_version("1.4.0", "2.0.0", _DICT_VERSION_STATUS) |
2085 | def status_unmute(self, id): | 1946 | def status_unmute(self, id): |
2086 | """ | 1947 | """ |
2087 | Unmute notifications for a status. | 1948 | Unmute notifications for a status. |
@@ -2092,7 +1953,7 @@ class Mastodon(Internals): | |||
2092 | url = '/api/v1/statuses/{0}/unmute'.format(str(id)) | 1953 | url = '/api/v1/statuses/{0}/unmute'.format(str(id)) |
2093 | return self.__api_request('POST', url) | 1954 | return self.__api_request('POST', url) |
2094 | 1955 | ||
2095 | @api_version("2.1.0", "2.1.0", __DICT_VERSION_STATUS) | 1956 | @api_version("2.1.0", "2.1.0", _DICT_VERSION_STATUS) |
2096 | def status_pin(self, id): | 1957 | def status_pin(self, id): |
2097 | """ | 1958 | """ |
2098 | Pin a status for the logged-in user. | 1959 | Pin a status for the logged-in user. |
@@ -2103,7 +1964,7 @@ class Mastodon(Internals): | |||
2103 | url = '/api/v1/statuses/{0}/pin'.format(str(id)) | 1964 | url = '/api/v1/statuses/{0}/pin'.format(str(id)) |
2104 | return self.__api_request('POST', url) | 1965 | return self.__api_request('POST', url) |
2105 | 1966 | ||
2106 | @api_version("2.1.0", "2.1.0", __DICT_VERSION_STATUS) | 1967 | @api_version("2.1.0", "2.1.0", _DICT_VERSION_STATUS) |
2107 | def status_unpin(self, id): | 1968 | def status_unpin(self, id): |
2108 | """ | 1969 | """ |
2109 | Unpin a pinned status for the logged-in user. | 1970 | Unpin a pinned status for the logged-in user. |
@@ -2114,7 +1975,7 @@ class Mastodon(Internals): | |||
2114 | url = '/api/v1/statuses/{0}/unpin'.format(str(id)) | 1975 | url = '/api/v1/statuses/{0}/unpin'.format(str(id)) |
2115 | return self.__api_request('POST', url) | 1976 | return self.__api_request('POST', url) |
2116 | 1977 | ||
2117 | @api_version("3.1.0", "3.1.0", __DICT_VERSION_STATUS) | 1978 | @api_version("3.1.0", "3.1.0", _DICT_VERSION_STATUS) |
2118 | def status_bookmark(self, id): | 1979 | def status_bookmark(self, id): |
2119 | """ | 1980 | """ |
2120 | Bookmark a status as the logged-in user. | 1981 | Bookmark a status as the logged-in user. |
@@ -2125,7 +1986,7 @@ class Mastodon(Internals): | |||
2125 | url = '/api/v1/statuses/{0}/bookmark'.format(str(id)) | 1986 | url = '/api/v1/statuses/{0}/bookmark'.format(str(id)) |
2126 | return self.__api_request('POST', url) | 1987 | return self.__api_request('POST', url) |
2127 | 1988 | ||
2128 | @api_version("3.1.0", "3.1.0", __DICT_VERSION_STATUS) | 1989 | @api_version("3.1.0", "3.1.0", _DICT_VERSION_STATUS) |
2129 | def status_unbookmark(self, id): | 1990 | def status_unbookmark(self, id): |
2130 | """ | 1991 | """ |
2131 | Unbookmark a bookmarked status for the logged-in user. | 1992 | Unbookmark a bookmarked status for the logged-in user. |
@@ -2139,7 +2000,7 @@ class Mastodon(Internals): | |||
2139 | ### | 2000 | ### |
2140 | # Writing data: Scheduled statuses | 2001 | # Writing data: Scheduled statuses |
2141 | ### | 2002 | ### |
2142 | @api_version("2.7.0", "2.7.0", __DICT_VERSION_SCHEDULED_STATUS) | 2003 | @api_version("2.7.0", "2.7.0", _DICT_VERSION_SCHEDULED_STATUS) |
2143 | def scheduled_status_update(self, id, scheduled_at): | 2004 | def scheduled_status_update(self, id, scheduled_at): |
2144 | """ | 2005 | """ |
2145 | Update the scheduled time of a scheduled status. | 2006 | Update the scheduled time of a scheduled status. |
@@ -2166,7 +2027,7 @@ class Mastodon(Internals): | |||
2166 | ### | 2027 | ### |
2167 | # Writing data: Polls | 2028 | # Writing data: Polls |
2168 | ### | 2029 | ### |
2169 | @api_version("2.8.0", "2.8.0", __DICT_VERSION_POLL) | 2030 | @api_version("2.8.0", "2.8.0", _DICT_VERSION_POLL) |
2170 | def poll_vote(self, id, choices): | 2031 | def poll_vote(self, id, choices): |
2171 | """ | 2032 | """ |
2172 | Vote in the given poll. | 2033 | Vote in the given poll. |
@@ -2218,7 +2079,7 @@ class Mastodon(Internals): | |||
2218 | ### | 2079 | ### |
2219 | # Writing data: Conversations | 2080 | # Writing data: Conversations |
2220 | ### | 2081 | ### |
2221 | @api_version("2.6.0", "2.6.0", __DICT_VERSION_CONVERSATION) | 2082 | @api_version("2.6.0", "2.6.0", _DICT_VERSION_CONVERSATION) |
2222 | def conversations_read(self, id): | 2083 | def conversations_read(self, id): |
2223 | """ | 2084 | """ |
2224 | Marks a single conversation as read. | 2085 | Marks a single conversation as read. |
@@ -2232,7 +2093,7 @@ class Mastodon(Internals): | |||
2232 | ### | 2093 | ### |
2233 | # Writing data: Accounts | 2094 | # Writing data: Accounts |
2234 | ### | 2095 | ### |
2235 | @api_version("1.0.0", "3.3.0", __DICT_VERSION_RELATIONSHIP) | 2096 | @api_version("1.0.0", "3.3.0", _DICT_VERSION_RELATIONSHIP) |
2236 | def account_follow(self, id, reblogs=True, notify=False): | 2097 | def account_follow(self, id, reblogs=True, notify=False): |
2237 | """ | 2098 | """ |
2238 | Follow a user. | 2099 | Follow a user. |
@@ -2251,7 +2112,7 @@ class Mastodon(Internals): | |||
2251 | url = '/api/v1/accounts/{0}/follow'.format(str(id)) | 2112 | url = '/api/v1/accounts/{0}/follow'.format(str(id)) |
2252 | return self.__api_request('POST', url, params) | 2113 | return self.__api_request('POST', url, params) |
2253 | 2114 | ||
2254 | @api_version("1.0.0", "2.1.0", __DICT_VERSION_ACCOUNT) | 2115 | @api_version("1.0.0", "2.1.0", _DICT_VERSION_ACCOUNT) |
2255 | def follows(self, uri): | 2116 | def follows(self, uri): |
2256 | """ | 2117 | """ |
2257 | Follow a remote user by uri (username@domain). | 2118 | Follow a remote user by uri (username@domain). |
@@ -2261,7 +2122,7 @@ class Mastodon(Internals): | |||
2261 | params = self.__generate_params(locals()) | 2122 | params = self.__generate_params(locals()) |
2262 | return self.__api_request('POST', '/api/v1/follows', params) | 2123 | return self.__api_request('POST', '/api/v1/follows', params) |
2263 | 2124 | ||
2264 | @api_version("1.0.0", "1.4.0", __DICT_VERSION_RELATIONSHIP) | 2125 | @api_version("1.0.0", "1.4.0", _DICT_VERSION_RELATIONSHIP) |
2265 | def account_unfollow(self, id): | 2126 | def account_unfollow(self, id): |
2266 | """ | 2127 | """ |
2267 | Unfollow a user. | 2128 | Unfollow a user. |
@@ -2271,7 +2132,7 @@ class Mastodon(Internals): | |||
2271 | id = self.__unpack_id(id) | 2132 | id = self.__unpack_id(id) |
2272 | return self.__api_request('POST', '/api/v1/accounts/{0}/unfollow'.format(str(id))) | 2133 | return self.__api_request('POST', '/api/v1/accounts/{0}/unfollow'.format(str(id))) |
2273 | 2134 | ||
2274 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_RELATIONSHIP) | 2135 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_RELATIONSHIP) |
2275 | def account_remove_from_followers(self, id): | 2136 | def account_remove_from_followers(self, id): |
2276 | """ | 2137 | """ |
2277 | Remove a user from the logged in users followers (i.e. make them unfollow the logged in | 2138 | Remove a user from the logged in users followers (i.e. make them unfollow the logged in |
@@ -2283,7 +2144,7 @@ class Mastodon(Internals): | |||
2283 | return self.__api_request('POST', '/api/v1/accounts/{0}/remove_from_followers'.format(str(id))) | 2144 | return self.__api_request('POST', '/api/v1/accounts/{0}/remove_from_followers'.format(str(id))) |
2284 | 2145 | ||
2285 | 2146 | ||
2286 | @api_version("1.0.0", "1.4.0", __DICT_VERSION_RELATIONSHIP) | 2147 | @api_version("1.0.0", "1.4.0", _DICT_VERSION_RELATIONSHIP) |
2287 | def account_block(self, id): | 2148 | def account_block(self, id): |
2288 | """ | 2149 | """ |
2289 | Block a user. | 2150 | Block a user. |
@@ -2294,7 +2155,7 @@ class Mastodon(Internals): | |||
2294 | url = '/api/v1/accounts/{0}/block'.format(str(id)) | 2155 | url = '/api/v1/accounts/{0}/block'.format(str(id)) |
2295 | return self.__api_request('POST', url) | 2156 | return self.__api_request('POST', url) |
2296 | 2157 | ||
2297 | @api_version("1.0.0", "1.4.0", __DICT_VERSION_RELATIONSHIP) | 2158 | @api_version("1.0.0", "1.4.0", _DICT_VERSION_RELATIONSHIP) |
2298 | def account_unblock(self, id): | 2159 | def account_unblock(self, id): |
2299 | """ | 2160 | """ |
2300 | Unblock a user. | 2161 | Unblock a user. |
@@ -2305,7 +2166,7 @@ class Mastodon(Internals): | |||
2305 | url = '/api/v1/accounts/{0}/unblock'.format(str(id)) | 2166 | url = '/api/v1/accounts/{0}/unblock'.format(str(id)) |
2306 | return self.__api_request('POST', url) | 2167 | return self.__api_request('POST', url) |
2307 | 2168 | ||
2308 | @api_version("1.1.0", "2.4.3", __DICT_VERSION_RELATIONSHIP) | 2169 | @api_version("1.1.0", "2.4.3", _DICT_VERSION_RELATIONSHIP) |
2309 | def account_mute(self, id, notifications=True, duration=None): | 2170 | def account_mute(self, id, notifications=True, duration=None): |
2310 | """ | 2171 | """ |
2311 | Mute a user. | 2172 | Mute a user. |
@@ -2321,7 +2182,7 @@ class Mastodon(Internals): | |||
2321 | url = '/api/v1/accounts/{0}/mute'.format(str(id)) | 2182 | url = '/api/v1/accounts/{0}/mute'.format(str(id)) |
2322 | return self.__api_request('POST', url, params) | 2183 | return self.__api_request('POST', url, params) |
2323 | 2184 | ||
2324 | @api_version("1.1.0", "1.4.0", __DICT_VERSION_RELATIONSHIP) | 2185 | @api_version("1.1.0", "1.4.0", _DICT_VERSION_RELATIONSHIP) |
2325 | def account_unmute(self, id): | 2186 | def account_unmute(self, id): |
2326 | """ | 2187 | """ |
2327 | Unmute a user. | 2188 | Unmute a user. |
@@ -2332,7 +2193,7 @@ class Mastodon(Internals): | |||
2332 | url = '/api/v1/accounts/{0}/unmute'.format(str(id)) | 2193 | url = '/api/v1/accounts/{0}/unmute'.format(str(id)) |
2333 | return self.__api_request('POST', url) | 2194 | return self.__api_request('POST', url) |
2334 | 2195 | ||
2335 | @api_version("1.1.1", "3.1.0", __DICT_VERSION_ACCOUNT) | 2196 | @api_version("1.1.1", "3.1.0", _DICT_VERSION_ACCOUNT) |
2336 | def account_update_credentials(self, display_name=None, note=None, | 2197 | def account_update_credentials(self, display_name=None, note=None, |
2337 | avatar=None, avatar_mime_type=None, | 2198 | avatar=None, avatar_mime_type=None, |
2338 | header=None, header_mime_type=None, | 2199 | header=None, header_mime_type=None, |
@@ -2387,7 +2248,7 @@ class Mastodon(Internals): | |||
2387 | params = self.__generate_params(params_initial) | 2248 | params = self.__generate_params(params_initial) |
2388 | return self.__api_request('PATCH', '/api/v1/accounts/update_credentials', params, files=files) | 2249 | return self.__api_request('PATCH', '/api/v1/accounts/update_credentials', params, files=files) |
2389 | 2250 | ||
2390 | @api_version("2.5.0", "2.5.0", __DICT_VERSION_RELATIONSHIP) | 2251 | @api_version("2.5.0", "2.5.0", _DICT_VERSION_RELATIONSHIP) |
2391 | def account_pin(self, id): | 2252 | def account_pin(self, id): |
2392 | """ | 2253 | """ |
2393 | Pin / endorse a user. | 2254 | Pin / endorse a user. |
@@ -2398,7 +2259,7 @@ class Mastodon(Internals): | |||
2398 | url = '/api/v1/accounts/{0}/pin'.format(str(id)) | 2259 | url = '/api/v1/accounts/{0}/pin'.format(str(id)) |
2399 | return self.__api_request('POST', url) | 2260 | return self.__api_request('POST', url) |
2400 | 2261 | ||
2401 | @api_version("2.5.0", "2.5.0", __DICT_VERSION_RELATIONSHIP) | 2262 | @api_version("2.5.0", "2.5.0", _DICT_VERSION_RELATIONSHIP) |
2402 | def account_unpin(self, id): | 2263 | def account_unpin(self, id): |
2403 | """ | 2264 | """ |
2404 | Unpin / un-endorse a user. | 2265 | Unpin / un-endorse a user. |
@@ -2409,7 +2270,7 @@ class Mastodon(Internals): | |||
2409 | url = '/api/v1/accounts/{0}/unpin'.format(str(id)) | 2270 | url = '/api/v1/accounts/{0}/unpin'.format(str(id)) |
2410 | return self.__api_request('POST', url) | 2271 | return self.__api_request('POST', url) |
2411 | 2272 | ||
2412 | @api_version("3.2.0", "3.2.0", __DICT_VERSION_RELATIONSHIP) | 2273 | @api_version("3.2.0", "3.2.0", _DICT_VERSION_RELATIONSHIP) |
2413 | def account_note_set(self, id, comment): | 2274 | def account_note_set(self, id, comment): |
2414 | """ | 2275 | """ |
2415 | Set a note (visible to the logged in user only) for the given account. | 2276 | Set a note (visible to the logged in user only) for the given account. |
@@ -2420,7 +2281,7 @@ class Mastodon(Internals): | |||
2420 | params = self.__generate_params(locals(), ["id"]) | 2281 | params = self.__generate_params(locals(), ["id"]) |
2421 | return self.__api_request('POST', '/api/v1/accounts/{0}/note'.format(str(id)), params) | 2282 | return self.__api_request('POST', '/api/v1/accounts/{0}/note'.format(str(id)), params) |
2422 | 2283 | ||
2423 | @api_version("3.3.0", "3.3.0", __DICT_VERSION_HASHTAG) | 2284 | @api_version("3.3.0", "3.3.0", _DICT_VERSION_HASHTAG) |
2424 | def account_featured_tags(self, id): | 2285 | def account_featured_tags(self, id): |
2425 | """ | 2286 | """ |
2426 | Get an account's featured hashtags. | 2287 | Get an account's featured hashtags. |
@@ -2433,7 +2294,7 @@ class Mastodon(Internals): | |||
2433 | ### | 2294 | ### |
2434 | # Writing data: Featured hashtags | 2295 | # Writing data: Featured hashtags |
2435 | ### | 2296 | ### |
2436 | @api_version("3.0.0", "3.0.0", __DICT_VERSION_FEATURED_TAG) | 2297 | @api_version("3.0.0", "3.0.0", _DICT_VERSION_FEATURED_TAG) |
2437 | def featured_tag_create(self, name): | 2298 | def featured_tag_create(self, name): |
2438 | """ | 2299 | """ |
2439 | Creates a new featured hashtag displayed on the logged-in user's profile. | 2300 | Creates a new featured hashtag displayed on the logged-in user's profile. |
@@ -2443,7 +2304,7 @@ class Mastodon(Internals): | |||
2443 | params = self.__generate_params(locals()) | 2304 | params = self.__generate_params(locals()) |
2444 | return self.__api_request('POST', '/api/v1/featured_tags', params) | 2305 | return self.__api_request('POST', '/api/v1/featured_tags', params) |
2445 | 2306 | ||
2446 | @api_version("3.0.0", "3.0.0", __DICT_VERSION_FEATURED_TAG) | 2307 | @api_version("3.0.0", "3.0.0", _DICT_VERSION_FEATURED_TAG) |
2447 | def featured_tag_delete(self, id): | 2308 | def featured_tag_delete(self, id): |
2448 | """ | 2309 | """ |
2449 | Deletes one of the logged-in user's featured hashtags. | 2310 | Deletes one of the logged-in user's featured hashtags. |
@@ -2455,7 +2316,7 @@ class Mastodon(Internals): | |||
2455 | ### | 2316 | ### |
2456 | # Writing data: Keyword filters | 2317 | # Writing data: Keyword filters |
2457 | ### | 2318 | ### |
2458 | @api_version("2.4.3", "2.4.3", __DICT_VERSION_FILTER) | 2319 | @api_version("2.4.3", "2.4.3", _DICT_VERSION_FILTER) |
2459 | def filter_create(self, phrase, context, irreversible=False, whole_word=True, expires_in=None): | 2320 | def filter_create(self, phrase, context, irreversible=False, whole_word=True, expires_in=None): |
2460 | """ | 2321 | """ |
2461 | Creates a new keyword filter. `phrase` is the phrase that should be | 2322 | Creates a new keyword filter. `phrase` is the phrase that should be |
@@ -2481,7 +2342,7 @@ class Mastodon(Internals): | |||
2481 | 2342 | ||
2482 | return self.__api_request('POST', '/api/v1/filters', params) | 2343 | return self.__api_request('POST', '/api/v1/filters', params) |
2483 | 2344 | ||
2484 | @api_version("2.4.3", "2.4.3", __DICT_VERSION_FILTER) | 2345 | @api_version("2.4.3", "2.4.3", _DICT_VERSION_FILTER) |
2485 | def filter_update(self, id, phrase=None, context=None, irreversible=None, whole_word=None, expires_in=None): | 2346 | def filter_update(self, id, phrase=None, context=None, irreversible=None, whole_word=None, expires_in=None): |
2486 | """ | 2347 | """ |
2487 | Updates the filter with the given `id`. Parameters are the same | 2348 | Updates the filter with the given `id`. Parameters are the same |
@@ -2506,7 +2367,7 @@ class Mastodon(Internals): | |||
2506 | ### | 2367 | ### |
2507 | # Writing data: Follow suggestions | 2368 | # Writing data: Follow suggestions |
2508 | ### | 2369 | ### |
2509 | @api_version("2.4.3", "2.4.3", __DICT_VERSION_ACCOUNT) | 2370 | @api_version("2.4.3", "2.4.3", _DICT_VERSION_ACCOUNT) |
2510 | def suggestion_delete(self, account_id): | 2371 | def suggestion_delete(self, account_id): |
2511 | """ | 2372 | """ |
2512 | Remove the user with the given `account_id` from the follow suggestions. | 2373 | Remove the user with the given `account_id` from the follow suggestions. |
@@ -2518,7 +2379,7 @@ class Mastodon(Internals): | |||
2518 | ### | 2379 | ### |
2519 | # Writing data: Lists | 2380 | # Writing data: Lists |
2520 | ### | 2381 | ### |
2521 | @api_version("2.1.0", "2.1.0", __DICT_VERSION_LIST) | 2382 | @api_version("2.1.0", "2.1.0", _DICT_VERSION_LIST) |
2522 | def list_create(self, title): | 2383 | def list_create(self, title): |
2523 | """ | 2384 | """ |
2524 | Create a new list with the given `title`. | 2385 | Create a new list with the given `title`. |
@@ -2528,7 +2389,7 @@ class Mastodon(Internals): | |||
2528 | params = self.__generate_params(locals()) | 2389 | params = self.__generate_params(locals()) |
2529 | return self.__api_request('POST', '/api/v1/lists', params) | 2390 | return self.__api_request('POST', '/api/v1/lists', params) |
2530 | 2391 | ||
2531 | @api_version("2.1.0", "2.1.0", __DICT_VERSION_LIST) | 2392 | @api_version("2.1.0", "2.1.0", _DICT_VERSION_LIST) |
2532 | def list_update(self, id, title): | 2393 | def list_update(self, id, title): |
2533 | """ | 2394 | """ |
2534 | Update info about a list, where "info" is really the lists `title`. | 2395 | Update info about a list, where "info" is really the lists `title`. |
@@ -2580,7 +2441,7 @@ class Mastodon(Internals): | |||
2580 | ### | 2441 | ### |
2581 | # Writing data: Reports | 2442 | # Writing data: Reports |
2582 | ### | 2443 | ### |
2583 | @api_version("1.1.0", "3.5.0", __DICT_VERSION_REPORT) | 2444 | @api_version("1.1.0", "3.5.0", _DICT_VERSION_REPORT) |
2584 | def report(self, account_id, status_ids=None, comment=None, forward=False, category=None, rule_ids=None): | 2445 | def report(self, account_id, status_ids=None, comment=None, forward=False, category=None, rule_ids=None): |
2585 | """ | 2446 | """ |
2586 | Report statuses to the instances administrators. | 2447 | Report statuses to the instances administrators. |
@@ -2616,7 +2477,7 @@ class Mastodon(Internals): | |||
2616 | ### | 2477 | ### |
2617 | # Writing data: Follow requests | 2478 | # Writing data: Follow requests |
2618 | ### | 2479 | ### |
2619 | @api_version("1.0.0", "3.0.0", __DICT_VERSION_RELATIONSHIP) | 2480 | @api_version("1.0.0", "3.0.0", _DICT_VERSION_RELATIONSHIP) |
2620 | def follow_request_authorize(self, id): | 2481 | def follow_request_authorize(self, id): |
2621 | """ | 2482 | """ |
2622 | Accept an incoming follow request. | 2483 | Accept an incoming follow request. |
@@ -2627,7 +2488,7 @@ class Mastodon(Internals): | |||
2627 | url = '/api/v1/follow_requests/{0}/authorize'.format(str(id)) | 2488 | url = '/api/v1/follow_requests/{0}/authorize'.format(str(id)) |
2628 | return self.__api_request('POST', url) | 2489 | return self.__api_request('POST', url) |
2629 | 2490 | ||
2630 | @api_version("1.0.0", "3.0.0", __DICT_VERSION_RELATIONSHIP) | 2491 | @api_version("1.0.0", "3.0.0", _DICT_VERSION_RELATIONSHIP) |
2631 | def follow_request_reject(self, id): | 2492 | def follow_request_reject(self, id): |
2632 | """ | 2493 | """ |
2633 | Reject an incoming follow request. | 2494 | Reject an incoming follow request. |
@@ -2641,7 +2502,7 @@ class Mastodon(Internals): | |||
2641 | ### | 2502 | ### |
2642 | # Writing data: Media | 2503 | # Writing data: Media |
2643 | ### | 2504 | ### |
2644 | @api_version("1.0.0", "3.2.0", __DICT_VERSION_MEDIA) | 2505 | @api_version("1.0.0", "3.2.0", _DICT_VERSION_MEDIA) |
2645 | def media_post(self, media_file, mime_type=None, description=None, focus=None, file_name=None, thumbnail=None, thumbnail_mime_type=None, synchronous=False): | 2506 | def media_post(self, media_file, mime_type=None, description=None, focus=None, file_name=None, thumbnail=None, thumbnail_mime_type=None, synchronous=False): |
2646 | """ | 2507 | """ |
2647 | Post an image, video or audio file. `media_file` can either be data or | 2508 | Post an image, video or audio file. `media_file` can either be data or |
@@ -2707,7 +2568,7 @@ class Mastodon(Internals): | |||
2707 | 2568 | ||
2708 | return ret_dict | 2569 | return ret_dict |
2709 | 2570 | ||
2710 | @api_version("2.3.0", "3.2.0", __DICT_VERSION_MEDIA) | 2571 | @api_version("2.3.0", "3.2.0", _DICT_VERSION_MEDIA) |
2711 | def media_update(self, id, description=None, focus=None, thumbnail=None, thumbnail_mime_type=None): | 2572 | def media_update(self, id, description=None, focus=None, thumbnail=None, thumbnail_mime_type=None): |
2712 | """ | 2573 | """ |
2713 | Update the metadata of the media file with the given `id`. `description` and | 2574 | Update the metadata of the media file with the given `id`. `description` and |
@@ -2733,7 +2594,7 @@ class Mastodon(Internals): | |||
2733 | else: | 2594 | else: |
2734 | return self.__api_request('PUT', '/api/v1/media/{0}'.format(str(id)), params) | 2595 | return self.__api_request('PUT', '/api/v1/media/{0}'.format(str(id)), params) |
2735 | 2596 | ||
2736 | @api_version("3.1.4", "3.1.4", __DICT_VERSION_MEDIA) | 2597 | @api_version("3.1.4", "3.1.4", _DICT_VERSION_MEDIA) |
2737 | def media(self, id): | 2598 | def media(self, id): |
2738 | """ | 2599 | """ |
2739 | Get the updated JSON for one non-attached / in progress media upload belonging | 2600 | Get the updated JSON for one non-attached / in progress media upload belonging |
@@ -2764,7 +2625,7 @@ class Mastodon(Internals): | |||
2764 | ## | 2625 | ## |
2765 | # Writing data: Read markers | 2626 | # Writing data: Read markers |
2766 | ## | 2627 | ## |
2767 | @api_version("3.0.0", "3.0.0", __DICT_VERSION_MARKER) | 2628 | @api_version("3.0.0", "3.0.0", _DICT_VERSION_MARKER) |
2768 | def markers_set(self, timelines, last_read_ids): | 2629 | def markers_set(self, timelines, last_read_ids): |
2769 | """ | 2630 | """ |
2770 | Set the "last read" marker(s) for the given timeline(s) to the given id(s) | 2631 | Set the "last read" marker(s) for the given timeline(s) to the given id(s) |
@@ -2793,7 +2654,7 @@ class Mastodon(Internals): | |||
2793 | ### | 2654 | ### |
2794 | # Writing data: Push subscriptions | 2655 | # Writing data: Push subscriptions |
2795 | ### | 2656 | ### |
2796 | @api_version("2.4.0", "2.4.0", __DICT_VERSION_PUSH) | 2657 | @api_version("2.4.0", "2.4.0", _DICT_VERSION_PUSH) |
2797 | def push_subscription_set(self, endpoint, encrypt_params, follow_events=None, | 2658 | def push_subscription_set(self, endpoint, encrypt_params, follow_events=None, |
2798 | favourite_events=None, reblog_events=None, | 2659 | favourite_events=None, reblog_events=None, |
2799 | mention_events=None, poll_events=None, | 2660 | mention_events=None, poll_events=None, |
@@ -2855,7 +2716,7 @@ class Mastodon(Internals): | |||
2855 | 2716 | ||
2856 | return self.__api_request('POST', '/api/v1/push/subscription', params) | 2717 | return self.__api_request('POST', '/api/v1/push/subscription', params) |
2857 | 2718 | ||
2858 | @api_version("2.4.0", "2.4.0", __DICT_VERSION_PUSH) | 2719 | @api_version("2.4.0", "2.4.0", _DICT_VERSION_PUSH) |
2859 | def push_subscription_update(self, follow_events=None, | 2720 | def push_subscription_update(self, follow_events=None, |
2860 | favourite_events=None, reblog_events=None, | 2721 | favourite_events=None, reblog_events=None, |
2861 | mention_events=None, poll_events=None, | 2722 | mention_events=None, poll_events=None, |
@@ -2942,7 +2803,7 @@ class Mastodon(Internals): | |||
2942 | ### | 2803 | ### |
2943 | # Moderation API | 2804 | # Moderation API |
2944 | ### | 2805 | ### |
2945 | @api_version("2.9.1", "4.0.0", __DICT_VERSION_ADMIN_ACCOUNT) | 2806 | @api_version("2.9.1", "4.0.0", _DICT_VERSION_ADMIN_ACCOUNT) |
2946 | def admin_accounts_v2(self, origin=None, by_domain=None, status=None, username=None, display_name=None, email=None, ip=None, | 2807 | def admin_accounts_v2(self, origin=None, by_domain=None, status=None, username=None, display_name=None, email=None, ip=None, |
2947 | permissions=None, invited_by=None, role_ids=None, max_id=None, min_id=None, since_id=None, limit=None): | 2808 | permissions=None, invited_by=None, role_ids=None, max_id=None, min_id=None, since_id=None, limit=None): |
2948 | """ | 2809 | """ |
@@ -2993,7 +2854,7 @@ class Mastodon(Internals): | |||
2993 | params = self.__generate_params(locals()) | 2854 | params = self.__generate_params(locals()) |
2994 | return self.__api_request('GET', '/api/v2/admin/accounts', params) | 2855 | return self.__api_request('GET', '/api/v2/admin/accounts', params) |
2995 | 2856 | ||
2996 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_ADMIN_ACCOUNT) | 2857 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_ADMIN_ACCOUNT) |
2997 | def admin_accounts(self, remote=False, by_domain=None, status='active', username=None, display_name=None, email=None, ip=None, staff_only=False, max_id=None, min_id=None, since_id=None, limit=None): | 2858 | def admin_accounts(self, remote=False, by_domain=None, status='active', username=None, display_name=None, email=None, ip=None, staff_only=False, max_id=None, min_id=None, since_id=None, limit=None): |
2998 | """ | 2859 | """ |
2999 | Currently a synonym for admin_accounts_v1, now deprecated. You are strongly encouraged to use admin_accounts_v2 instead, since this one is kind of bad. | 2860 | Currently a synonym for admin_accounts_v1, now deprecated. You are strongly encouraged to use admin_accounts_v2 instead, since this one is kind of bad. |
@@ -3014,7 +2875,7 @@ class Mastodon(Internals): | |||
3014 | since_id=since_id | 2875 | since_id=since_id |
3015 | ) | 2876 | ) |
3016 | 2877 | ||
3017 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_ADMIN_ACCOUNT) | 2878 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_ADMIN_ACCOUNT) |
3018 | def admin_accounts_v1(self, remote=False, by_domain=None, status='active', username=None, display_name=None, email=None, ip=None, staff_only=False, max_id=None, min_id=None, since_id=None, limit=None): | 2879 | def admin_accounts_v1(self, remote=False, by_domain=None, status='active', username=None, display_name=None, email=None, ip=None, staff_only=False, max_id=None, min_id=None, since_id=None, limit=None): |
3019 | """ | 2880 | """ |
3020 | Fetches a list of accounts that match given criteria. By default, local accounts are returned. | 2881 | Fetches a list of accounts that match given criteria. By default, local accounts are returned. |
@@ -3065,7 +2926,7 @@ class Mastodon(Internals): | |||
3065 | 2926 | ||
3066 | return self.__api_request('GET', '/api/v1/admin/accounts', params) | 2927 | return self.__api_request('GET', '/api/v1/admin/accounts', params) |
3067 | 2928 | ||
3068 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_ADMIN_ACCOUNT) | 2929 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_ADMIN_ACCOUNT) |
3069 | def admin_account(self, id): | 2930 | def admin_account(self, id): |
3070 | """ | 2931 | """ |
3071 | Fetches a single :ref:`admin account dict <admin account dict>` for the user with the given id. | 2932 | Fetches a single :ref:`admin account dict <admin account dict>` for the user with the given id. |
@@ -3075,7 +2936,7 @@ class Mastodon(Internals): | |||
3075 | id = self.__unpack_id(id) | 2936 | id = self.__unpack_id(id) |
3076 | return self.__api_request('GET', '/api/v1/admin/accounts/{0}'.format(id)) | 2937 | return self.__api_request('GET', '/api/v1/admin/accounts/{0}'.format(id)) |
3077 | 2938 | ||
3078 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_ADMIN_ACCOUNT) | 2939 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_ADMIN_ACCOUNT) |
3079 | def admin_account_enable(self, id): | 2940 | def admin_account_enable(self, id): |
3080 | """ | 2941 | """ |
3081 | Reenables login for a local account for which login has been disabled. | 2942 | Reenables login for a local account for which login has been disabled. |
@@ -3085,7 +2946,7 @@ class Mastodon(Internals): | |||
3085 | id = self.__unpack_id(id) | 2946 | id = self.__unpack_id(id) |
3086 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/enable'.format(id)) | 2947 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/enable'.format(id)) |
3087 | 2948 | ||
3088 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_ADMIN_ACCOUNT) | 2949 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_ADMIN_ACCOUNT) |
3089 | def admin_account_approve(self, id): | 2950 | def admin_account_approve(self, id): |
3090 | """ | 2951 | """ |
3091 | Approves a pending account. | 2952 | Approves a pending account. |
@@ -3095,7 +2956,7 @@ class Mastodon(Internals): | |||
3095 | id = self.__unpack_id(id) | 2956 | id = self.__unpack_id(id) |
3096 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/approve'.format(id)) | 2957 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/approve'.format(id)) |
3097 | 2958 | ||
3098 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_ADMIN_ACCOUNT) | 2959 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_ADMIN_ACCOUNT) |
3099 | def admin_account_reject(self, id): | 2960 | def admin_account_reject(self, id): |
3100 | """ | 2961 | """ |
3101 | Rejects and deletes a pending account. | 2962 | Rejects and deletes a pending account. |
@@ -3105,7 +2966,7 @@ class Mastodon(Internals): | |||
3105 | id = self.__unpack_id(id) | 2966 | id = self.__unpack_id(id) |
3106 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/reject'.format(id)) | 2967 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/reject'.format(id)) |
3107 | 2968 | ||
3108 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_ADMIN_ACCOUNT) | 2969 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_ADMIN_ACCOUNT) |
3109 | def admin_account_unsilence(self, id): | 2970 | def admin_account_unsilence(self, id): |
3110 | """ | 2971 | """ |
3111 | Unsilences an account. | 2972 | Unsilences an account. |
@@ -3115,7 +2976,7 @@ class Mastodon(Internals): | |||
3115 | id = self.__unpack_id(id) | 2976 | id = self.__unpack_id(id) |
3116 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/unsilence'.format(id)) | 2977 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/unsilence'.format(id)) |
3117 | 2978 | ||
3118 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_ADMIN_ACCOUNT) | 2979 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_ADMIN_ACCOUNT) |
3119 | def admin_account_unsuspend(self, id): | 2980 | def admin_account_unsuspend(self, id): |
3120 | """ | 2981 | """ |
3121 | Unsuspends an account. | 2982 | Unsuspends an account. |
@@ -3125,7 +2986,7 @@ class Mastodon(Internals): | |||
3125 | id = self.__unpack_id(id) | 2986 | id = self.__unpack_id(id) |
3126 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/unsuspend'.format(id)) | 2987 | return self.__api_request('POST', '/api/v1/admin/accounts/{0}/unsuspend'.format(id)) |
3127 | 2988 | ||
3128 | @api_version("3.3.0", "3.3.0", __DICT_VERSION_ADMIN_ACCOUNT) | 2989 | @api_version("3.3.0", "3.3.0", _DICT_VERSION_ADMIN_ACCOUNT) |
3129 | def admin_account_delete(self, id): | 2990 | def admin_account_delete(self, id): |
3130 | """ | 2991 | """ |
3131 | Delete a local user account. | 2992 | Delete a local user account. |
@@ -3135,7 +2996,7 @@ class Mastodon(Internals): | |||
3135 | id = self.__unpack_id(id) | 2996 | id = self.__unpack_id(id) |
3136 | return self.__api_request('DELETE', '/api/v1/admin/accounts/{0}'.format(id)) | 2997 | return self.__api_request('DELETE', '/api/v1/admin/accounts/{0}'.format(id)) |
3137 | 2998 | ||
3138 | @api_version("3.3.0", "3.3.0", __DICT_VERSION_ADMIN_ACCOUNT) | 2999 | @api_version("3.3.0", "3.3.0", _DICT_VERSION_ADMIN_ACCOUNT) |
3139 | def admin_account_unsensitive(self, id): | 3000 | def admin_account_unsensitive(self, id): |
3140 | """ | 3001 | """ |
3141 | Unmark an account as force-sensitive. | 3002 | Unmark an account as force-sensitive. |
@@ -3182,7 +3043,7 @@ class Mastodon(Internals): | |||
3182 | self.__api_request( | 3043 | self.__api_request( |
3183 | 'POST', '/api/v1/admin/accounts/{0}/action'.format(id), params) | 3044 | 'POST', '/api/v1/admin/accounts/{0}/action'.format(id), params) |
3184 | 3045 | ||
3185 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_REPORT) | 3046 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_REPORT) |
3186 | def admin_reports(self, resolved=False, account_id=None, target_account_id=None, max_id=None, min_id=None, since_id=None, limit=None): | 3047 | def admin_reports(self, resolved=False, account_id=None, target_account_id=None, max_id=None, min_id=None, since_id=None, limit=None): |
3187 | """ | 3048 | """ |
3188 | Fetches the list of reports. | 3049 | Fetches the list of reports. |
@@ -3213,7 +3074,7 @@ class Mastodon(Internals): | |||
3213 | params = self.__generate_params(locals()) | 3074 | params = self.__generate_params(locals()) |
3214 | return self.__api_request('GET', '/api/v1/admin/reports', params) | 3075 | return self.__api_request('GET', '/api/v1/admin/reports', params) |
3215 | 3076 | ||
3216 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_REPORT) | 3077 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_REPORT) |
3217 | def admin_report(self, id): | 3078 | def admin_report(self, id): |
3218 | """ | 3079 | """ |
3219 | Fetches the report with the given id. | 3080 | Fetches the report with the given id. |
@@ -3223,7 +3084,7 @@ class Mastodon(Internals): | |||
3223 | id = self.__unpack_id(id) | 3084 | id = self.__unpack_id(id) |
3224 | return self.__api_request('GET', '/api/v1/admin/reports/{0}'.format(id)) | 3085 | return self.__api_request('GET', '/api/v1/admin/reports/{0}'.format(id)) |
3225 | 3086 | ||
3226 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_REPORT) | 3087 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_REPORT) |
3227 | def admin_report_assign(self, id): | 3088 | def admin_report_assign(self, id): |
3228 | """ | 3089 | """ |
3229 | Assigns the given report to the logged-in user. | 3090 | Assigns the given report to the logged-in user. |
@@ -3233,7 +3094,7 @@ class Mastodon(Internals): | |||
3233 | id = self.__unpack_id(id) | 3094 | id = self.__unpack_id(id) |
3234 | return self.__api_request('POST', '/api/v1/admin/reports/{0}/assign_to_self'.format(id)) | 3095 | return self.__api_request('POST', '/api/v1/admin/reports/{0}/assign_to_self'.format(id)) |
3235 | 3096 | ||
3236 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_REPORT) | 3097 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_REPORT) |
3237 | def admin_report_unassign(self, id): | 3098 | def admin_report_unassign(self, id): |
3238 | """ | 3099 | """ |
3239 | Unassigns the given report from the logged-in user. | 3100 | Unassigns the given report from the logged-in user. |
@@ -3243,7 +3104,7 @@ class Mastodon(Internals): | |||
3243 | id = self.__unpack_id(id) | 3104 | id = self.__unpack_id(id) |
3244 | return self.__api_request('POST', '/api/v1/admin/reports/{0}/unassign'.format(id)) | 3105 | return self.__api_request('POST', '/api/v1/admin/reports/{0}/unassign'.format(id)) |
3245 | 3106 | ||
3246 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_REPORT) | 3107 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_REPORT) |
3247 | def admin_report_reopen(self, id): | 3108 | def admin_report_reopen(self, id): |
3248 | """ | 3109 | """ |
3249 | Reopens a closed report. | 3110 | Reopens a closed report. |
@@ -3253,7 +3114,7 @@ class Mastodon(Internals): | |||
3253 | id = self.__unpack_id(id) | 3114 | id = self.__unpack_id(id) |
3254 | return self.__api_request('POST', '/api/v1/admin/reports/{0}/reopen'.format(id)) | 3115 | return self.__api_request('POST', '/api/v1/admin/reports/{0}/reopen'.format(id)) |
3255 | 3116 | ||
3256 | @api_version("2.9.1", "2.9.1", __DICT_VERSION_REPORT) | 3117 | @api_version("2.9.1", "2.9.1", _DICT_VERSION_REPORT) |
3257 | def admin_report_resolve(self, id): | 3118 | def admin_report_resolve(self, id): |
3258 | """ | 3119 | """ |
3259 | Marks a report as resolved (without taking any action). | 3120 | Marks a report as resolved (without taking any action). |
@@ -3263,7 +3124,7 @@ class Mastodon(Internals): | |||
3263 | id = self.__unpack_id(id) | 3124 | id = self.__unpack_id(id) |
3264 | return self.__api_request('POST', '/api/v1/admin/reports/{0}/resolve'.format(id)) | 3125 | return self.__api_request('POST', '/api/v1/admin/reports/{0}/resolve'.format(id)) |
3265 | 3126 | ||
3266 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_HASHTAG) | 3127 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_HASHTAG) |
3267 | def admin_trending_tags(self, limit=None): | 3128 | def admin_trending_tags(self, limit=None): |
3268 | """ | 3129 | """ |
3269 | Admin version of :ref:`trending_tags() <trending_tags()>`. Includes unapproved tags. | 3130 | Admin version of :ref:`trending_tags() <trending_tags()>`. Includes unapproved tags. |
@@ -3274,7 +3135,7 @@ class Mastodon(Internals): | |||
3274 | params = self.__generate_params(locals()) | 3135 | params = self.__generate_params(locals()) |
3275 | return self.__api_request('GET', '/api/v1/admin/trends/tags', params) | 3136 | return self.__api_request('GET', '/api/v1/admin/trends/tags', params) |
3276 | 3137 | ||
3277 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_STATUS) | 3138 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_STATUS) |
3278 | def admin_trending_statuses(self): | 3139 | def admin_trending_statuses(self): |
3279 | """ | 3140 | """ |
3280 | Admin version of :ref:`trending_statuses() <trending_statuses()>`. Includes unapproved tags. | 3141 | Admin version of :ref:`trending_statuses() <trending_statuses()>`. Includes unapproved tags. |
@@ -3285,7 +3146,7 @@ class Mastodon(Internals): | |||
3285 | params = self.__generate_params(locals()) | 3146 | params = self.__generate_params(locals()) |
3286 | return self.__api_request('GET', '/api/v1/admin/trends/statuses', params) | 3147 | return self.__api_request('GET', '/api/v1/admin/trends/statuses', params) |
3287 | 3148 | ||
3288 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_CARD) | 3149 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_CARD) |
3289 | def admin_trending_links(self): | 3150 | def admin_trending_links(self): |
3290 | """ | 3151 | """ |
3291 | Admin version of :ref:`trending_links() <trending_links()>`. Includes unapproved tags. | 3152 | Admin version of :ref:`trending_links() <trending_links()>`. Includes unapproved tags. |
@@ -3296,7 +3157,7 @@ class Mastodon(Internals): | |||
3296 | params = self.__generate_params(locals()) | 3157 | params = self.__generate_params(locals()) |
3297 | return self.__api_request('GET', '/api/v1/admin/trends/links', params) | 3158 | return self.__api_request('GET', '/api/v1/admin/trends/links', params) |
3298 | 3159 | ||
3299 | @api_version("4.0.0", "4.0.0", __DICT_VERSION_ADMIN_DOMAIN_BLOCK) | 3160 | @api_version("4.0.0", "4.0.0", _DICT_VERSION_ADMIN_DOMAIN_BLOCK) |
3300 | def admin_domain_blocks(self, id=None, limit:int=None): | 3161 | def admin_domain_blocks(self, id=None, limit:int=None): |
3301 | """ | 3162 | """ |
3302 | Fetches a list of blocked domains. Requires scope `admin:read:domain_blocks`. | 3163 | Fetches a list of blocked domains. Requires scope `admin:read:domain_blocks`. |
@@ -3312,7 +3173,7 @@ class Mastodon(Internals): | |||
3312 | params = self.__generate_params(locals(),['limit']) | 3173 | params = self.__generate_params(locals(),['limit']) |
3313 | return self.__api_request('GET', '/api/v1/admin/domain_blocks/', params) | 3174 | return self.__api_request('GET', '/api/v1/admin/domain_blocks/', params) |
3314 | 3175 | ||
3315 | @api_version("4.0.0", "4.0.0", __DICT_VERSION_ADMIN_DOMAIN_BLOCK) | 3176 | @api_version("4.0.0", "4.0.0", _DICT_VERSION_ADMIN_DOMAIN_BLOCK) |
3316 | def admin_create_domain_block(self, domain:str, severity:str=None, reject_media:bool=None, reject_reports:bool=None, private_comment:str=None, public_comment:str=None, obfuscate:bool=None): | 3177 | def admin_create_domain_block(self, domain:str, severity:str=None, reject_media:bool=None, reject_reports:bool=None, private_comment:str=None, public_comment:str=None, obfuscate:bool=None): |
3317 | """ | 3178 | """ |
3318 | Perform a moderation action on a domain. Requires scope `admin:write:domain_blocks`. | 3179 | Perform a moderation action on a domain. Requires scope `admin:write:domain_blocks`. |
@@ -3337,7 +3198,7 @@ class Mastodon(Internals): | |||
3337 | params = self.__generate_params(locals()) | 3198 | params = self.__generate_params(locals()) |
3338 | return self.__api_request('POST', '/api/v1/admin/domain_blocks/', params) | 3199 | return self.__api_request('POST', '/api/v1/admin/domain_blocks/', params) |
3339 | 3200 | ||
3340 | @api_version("4.0.0", "4.0.0", __DICT_VERSION_ADMIN_DOMAIN_BLOCK) | 3201 | @api_version("4.0.0", "4.0.0", _DICT_VERSION_ADMIN_DOMAIN_BLOCK) |
3341 | def admin_update_domain_block(self, id, severity:str=None, reject_media:bool=None, reject_reports:bool=None, private_comment:str=None, public_comment:str=None, obfuscate:bool=None): | 3202 | def admin_update_domain_block(self, id, severity:str=None, reject_media:bool=None, reject_reports:bool=None, private_comment:str=None, public_comment:str=None, obfuscate:bool=None): |
3342 | """ | 3203 | """ |
3343 | Modify existing moderation action on a domain. Requires scope `admin:write:domain_blocks`. | 3204 | Modify existing moderation action on a domain. Requires scope `admin:write:domain_blocks`. |
@@ -3363,7 +3224,7 @@ class Mastodon(Internals): | |||
3363 | params = self.__generate_params(locals(), ["id"]) | 3224 | params = self.__generate_params(locals(), ["id"]) |
3364 | return self.__api_request('PUT', '/api/v1/admin/domain_blocks/{0}'.format(id), params) | 3225 | return self.__api_request('PUT', '/api/v1/admin/domain_blocks/{0}'.format(id), params) |
3365 | 3226 | ||
3366 | @api_version("4.0.0", "4.0.0", __DICT_VERSION_ADMIN_DOMAIN_BLOCK) | 3227 | @api_version("4.0.0", "4.0.0", _DICT_VERSION_ADMIN_DOMAIN_BLOCK) |
3367 | def admin_delete_domain_block(self, id=None): | 3228 | def admin_delete_domain_block(self, id=None): |
3368 | """ | 3229 | """ |
3369 | Removes moderation action against a given domain. Requires scope `admin:write:domain_blocks`. | 3230 | Removes moderation action against a given domain. Requires scope `admin:write:domain_blocks`. |
@@ -3378,7 +3239,7 @@ class Mastodon(Internals): | |||
3378 | else: | 3239 | else: |
3379 | raise AttributeError("You must provide an id of an existing domain block to remove it.") | 3240 | raise AttributeError("You must provide an id of an existing domain block to remove it.") |
3380 | 3241 | ||
3381 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_ADMIN_MEASURE) | 3242 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_ADMIN_MEASURE) |
3382 | def admin_measures(self, start_at, end_at, active_users=False, new_users=False, interactions=False, opened_reports = False, resolved_reports=False, | 3243 | def admin_measures(self, start_at, end_at, active_users=False, new_users=False, interactions=False, opened_reports = False, resolved_reports=False, |
3383 | tag_accounts=None, tag_uses=None, tag_servers=None, instance_accounts=None, instance_media_attachments=None, instance_reports=None, | 3244 | tag_accounts=None, tag_uses=None, tag_servers=None, instance_accounts=None, instance_media_attachments=None, instance_reports=None, |
3384 | instance_statuses=None, instance_follows=None, instance_followers=None): | 3245 | instance_statuses=None, instance_follows=None, instance_followers=None): |
@@ -3433,7 +3294,7 @@ class Mastodon(Internals): | |||
3433 | 3294 | ||
3434 | return self.__api_request('POST', '/api/v1/admin/measures', params, use_json=True) | 3295 | return self.__api_request('POST', '/api/v1/admin/measures', params, use_json=True) |
3435 | 3296 | ||
3436 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_ADMIN_DIMENSION) | 3297 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_ADMIN_DIMENSION) |
3437 | def admin_dimensions(self, start_at, end_at, limit=None, languages=False, sources=False, servers=False, space_usage=False, software_versions=False, | 3298 | def admin_dimensions(self, start_at, end_at, limit=None, languages=False, sources=False, servers=False, space_usage=False, software_versions=False, |
3438 | tag_servers=None, tag_languages=None, instance_accounts=None, instance_languages=None): | 3299 | tag_servers=None, tag_languages=None, instance_accounts=None, instance_languages=None): |
3439 | """ | 3300 | """ |
@@ -3485,7 +3346,7 @@ class Mastodon(Internals): | |||
3485 | 3346 | ||
3486 | return self.__api_request('POST', '/api/v1/admin/dimensions', params, use_json=True) | 3347 | return self.__api_request('POST', '/api/v1/admin/dimensions', params, use_json=True) |
3487 | 3348 | ||
3488 | @api_version("3.5.0", "3.5.0", __DICT_VERSION_ADMIN_RETENTION) | 3349 | @api_version("3.5.0", "3.5.0", _DICT_VERSION_ADMIN_RETENTION) |
3489 | def admin_retention(self, start_at, end_at, frequency="day"): | 3350 | def admin_retention(self, start_at, end_at, frequency="day"): |
3490 | """ | 3351 | """ |
3491 | Gets user retention statistics (at `frequency` - "day" or "month" - granularity) between `start_at` and `end_at`. | 3352 | Gets user retention statistics (at `frequency` - "day" or "month" - granularity) between `start_at` and `end_at`. |
@@ -3540,7 +3401,7 @@ class Mastodon(Internals): | |||
3540 | 3401 | ||
3541 | return priv_dict, pub_dict | 3402 | return priv_dict, pub_dict |
3542 | 3403 | ||
3543 | @api_version("2.4.0", "2.4.0", __DICT_VERSION_PUSH_NOTIF) | 3404 | @api_version("2.4.0", "2.4.0", _DICT_VERSION_PUSH_NOTIF) |
3544 | def push_subscription_decrypt_push(self, data, decrypt_params, encryption_header, crypto_key_header): | 3405 | def push_subscription_decrypt_push(self, data, decrypt_params, encryption_header, crypto_key_header): |
3545 | """ | 3406 | """ |
3546 | Decrypts `data` received in a webpush request. Requires the private key dict | 3407 | Decrypts `data` received in a webpush request. Requires the private key dict |
@@ -3682,7 +3543,7 @@ class Mastodon(Internals): | |||
3682 | ### | 3543 | ### |
3683 | # Streaming | 3544 | # Streaming |
3684 | ### | 3545 | ### |
3685 | @api_version("1.1.0", "1.4.2", __DICT_VERSION_STATUS) | 3546 | @api_version("1.1.0", "1.4.2", _DICT_VERSION_STATUS) |
3686 | def stream_user(self, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC): | 3547 | def stream_user(self, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC): |
3687 | """ | 3548 | """ |
3688 | Streams events that are relevant to the authorized user, i.e. home | 3549 | Streams events that are relevant to the authorized user, i.e. home |
@@ -3690,21 +3551,21 @@ class Mastodon(Internals): | |||
3690 | """ | 3551 | """ |
3691 | return self.__stream('/api/v1/streaming/user', listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) | 3552 | return self.__stream('/api/v1/streaming/user', listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) |
3692 | 3553 | ||
3693 | @api_version("1.1.0", "1.4.2", __DICT_VERSION_STATUS) | 3554 | @api_version("1.1.0", "1.4.2", _DICT_VERSION_STATUS) |
3694 | def stream_public(self, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC): | 3555 | def stream_public(self, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC): |
3695 | """ | 3556 | """ |
3696 | Streams public events. | 3557 | Streams public events. |
3697 | """ | 3558 | """ |
3698 | return self.__stream('/api/v1/streaming/public', listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) | 3559 | return self.__stream('/api/v1/streaming/public', listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) |
3699 | 3560 | ||
3700 | @api_version("1.1.0", "1.4.2", __DICT_VERSION_STATUS) | 3561 | @api_version("1.1.0", "1.4.2", _DICT_VERSION_STATUS) |
3701 | def stream_local(self, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC): | 3562 | def stream_local(self, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC): |
3702 | """ | 3563 | """ |
3703 | Streams local public events. | 3564 | Streams local public events. |
3704 | """ | 3565 | """ |
3705 | return self.__stream('/api/v1/streaming/public/local', listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) | 3566 | return self.__stream('/api/v1/streaming/public/local', listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) |
3706 | 3567 | ||
3707 | @api_version("1.1.0", "1.4.2", __DICT_VERSION_STATUS) | 3568 | @api_version("1.1.0", "1.4.2", _DICT_VERSION_STATUS) |
3708 | def stream_hashtag(self, tag, listener, local=False, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC): | 3569 | def stream_hashtag(self, tag, listener, local=False, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC): |
3709 | """ | 3570 | """ |
3710 | Stream for all public statuses for the hashtag 'tag' seen by the connected | 3571 | Stream for all public statuses for the hashtag 'tag' seen by the connected |
@@ -3720,7 +3581,7 @@ class Mastodon(Internals): | |||
3720 | base += '/local' | 3581 | base += '/local' |
3721 | return self.__stream("{}?tag={}".format(base, tag), listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) | 3582 | return self.__stream("{}?tag={}".format(base, tag), listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) |
3722 | 3583 | ||
3723 | @api_version("2.1.0", "2.1.0", __DICT_VERSION_STATUS) | 3584 | @api_version("2.1.0", "2.1.0", _DICT_VERSION_STATUS) |
3724 | def stream_list(self, id, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC): | 3585 | def stream_list(self, id, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC): |
3725 | """ | 3586 | """ |
3726 | Stream events for the current user, restricted to accounts on the given | 3587 | Stream events for the current user, restricted to accounts on the given |
@@ -3729,7 +3590,7 @@ class Mastodon(Internals): | |||
3729 | id = self.__unpack_id(id) | 3590 | id = self.__unpack_id(id) |
3730 | return self.__stream("/api/v1/streaming/list?list={}".format(id), listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) | 3591 | return self.__stream("/api/v1/streaming/list?list={}".format(id), listener, run_async=run_async, timeout=timeout, reconnect_async=reconnect_async, reconnect_async_wait_sec=reconnect_async_wait_sec) |
3731 | 3592 | ||
3732 | @api_version("2.6.0", "2.6.0", __DICT_VERSION_STATUS) | 3593 | @api_version("2.6.0", "2.6.0", _DICT_VERSION_STATUS) |
3733 | def stream_direct(self, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC): | 3594 | def stream_direct(self, listener, run_async=False, timeout=_DEFAULT_STREAM_TIMEOUT, reconnect_async=False, reconnect_async_wait_sec=_DEFAULT_STREAM_RECONNECT_WAIT_SEC): |
3734 | """ | 3595 | """ |
3735 | Streams direct message events for the logged-in user, as conversation events. | 3596 | Streams direct message events for the logged-in user, as conversation events. |
diff --git a/mastodon/accounts.py b/mastodon/accounts.py new file mode 100644 index 0000000..dcdd8de --- /dev/null +++ b/mastodon/accounts.py | |||
@@ -0,0 +1,105 @@ | |||
1 | from .defaults import _DEFAULT_SCOPES, _SCOPE_SETS | ||
2 | from .error import MastodonIllegalArgumentError, MastodonAPIError | ||
3 | from .utility import api_version | ||
4 | |||
5 | class Mastodon(): | ||
6 | @api_version("2.7.0", "2.7.0", "3.4.0") | ||
7 | def create_account(self, username, password, email, agreement=False, reason=None, locale="en", scopes=_DEFAULT_SCOPES, to_file=None, return_detailed_error=False): | ||
8 | """ | ||
9 | Creates a new user account with the given username, password and email. "agreement" | ||
10 | must be set to true (after showing the user the instance's user agreement and having | ||
11 | them agree to it), "locale" specifies the language for the confirmation email as an | ||
12 | ISO 639-1 (two letter) or, if a language does not have one, 639-3 (three letter) language | ||
13 | code. `reason` can be used to specify why a user would like to join if approved-registrations | ||
14 | mode is on. | ||
15 | |||
16 | Does not require an access token, but does require a client grant. | ||
17 | |||
18 | By default, this method is rate-limited by IP to 5 requests per 30 minutes. | ||
19 | |||
20 | Returns an access token (just like log_in), which it can also persist to to_file, | ||
21 | and sets it internally so that the user is now logged in. Note that this token | ||
22 | can only be used after the user has confirmed their email. | ||
23 | |||
24 | By default, the function will throw if the account could not be created. Alternately, | ||
25 | when `return_detailed_error` is passed, Mastodon.py will return the detailed error | ||
26 | response that the API provides (Starting from version 3.4.0 - not checked here) as an dict with | ||
27 | error details as the second return value and the token returned as `None` in case of error. | ||
28 | The dict will contain a text `error` values as well as a `details` value which is a dict with | ||
29 | one optional key for each potential field (`username`, `password`, `email` and `agreement`), | ||
30 | each if present containing a dict with an `error` category and free text `description`. | ||
31 | Valid error categories are: | ||
32 | |||
33 | * ERR_BLOCKED - When e-mail provider is not allowed | ||
34 | * ERR_UNREACHABLE - When e-mail address does not resolve to any IP via DNS (MX, A, AAAA) | ||
35 | * ERR_TAKEN - When username or e-mail are already taken | ||
36 | * ERR_RESERVED - When a username is reserved, e.g. "webmaster" or "admin" | ||
37 | * ERR_ACCEPTED - When agreement has not been accepted | ||
38 | * ERR_BLANK - When a required attribute is blank | ||
39 | * ERR_INVALID - When an attribute is malformed, e.g. wrong characters or invalid e-mail address | ||
40 | * ERR_TOO_LONG - When an attribute is over the character limit | ||
41 | * ERR_TOO_SHORT - When an attribute is under the character requirement | ||
42 | * ERR_INCLUSION - When an attribute is not one of the allowed values, e.g. unsupported locale | ||
43 | """ | ||
44 | params = self.__generate_params(locals(), ['to_file', 'scopes']) | ||
45 | params['client_id'] = self.client_id | ||
46 | params['client_secret'] = self.client_secret | ||
47 | |||
48 | if not agreement: | ||
49 | del params['agreement'] | ||
50 | |||
51 | # Step 1: Get a user-free token via oauth | ||
52 | try: | ||
53 | oauth_params = {} | ||
54 | oauth_params['scope'] = " ".join(scopes) | ||
55 | oauth_params['client_id'] = self.client_id | ||
56 | oauth_params['client_secret'] = self.client_secret | ||
57 | oauth_params['grant_type'] = 'client_credentials' | ||
58 | |||
59 | response = self.__api_request('POST', '/oauth/token', oauth_params, do_ratelimiting=False) | ||
60 | temp_access_token = response['access_token'] | ||
61 | except Exception as e: | ||
62 | raise MastodonIllegalArgumentError('Invalid request during oauth phase: %s' % e) | ||
63 | |||
64 | # Step 2: Use that to create a user | ||
65 | try: | ||
66 | response = self.__api_request('POST', '/api/v1/accounts', params, do_ratelimiting=False, access_token_override=temp_access_token, skip_error_check=True) | ||
67 | if "error" in response: | ||
68 | if return_detailed_error: | ||
69 | return None, response | ||
70 | raise MastodonIllegalArgumentError('Invalid request: %s' % e) | ||
71 | self.access_token = response['access_token'] | ||
72 | self.__set_refresh_token(response.get('refresh_token')) | ||
73 | self.__set_token_expired(int(response.get('expires_in', 0))) | ||
74 | except Exception as e: | ||
75 | raise MastodonIllegalArgumentError('Invalid request') | ||
76 | |||
77 | # Step 3: Check scopes, persist, et cetera | ||
78 | received_scopes = response["scope"].split(" ") | ||
79 | for scope_set in _SCOPE_SETS.keys(): | ||
80 | if scope_set in received_scopes: | ||
81 | received_scopes += _SCOPE_SETS[scope_set] | ||
82 | |||
83 | if not set(scopes) <= set(received_scopes): | ||
84 | raise MastodonAPIError('Granted scopes "' + " ".join(received_scopes) + '" do not contain all of the requested scopes "' + " ".join(scopes) + '".') | ||
85 | |||
86 | if to_file is not None: | ||
87 | with open(to_file, 'w') as token_file: | ||
88 | token_file.write(response['access_token'] + "\n") | ||
89 | token_file.write(self.api_base_url + "\n") | ||
90 | |||
91 | self.__logged_in_id = None | ||
92 | |||
93 | if return_detailed_error: | ||
94 | return response['access_token'], {} | ||
95 | else: | ||
96 | return response['access_token'] | ||
97 | |||
98 | @api_version("3.4.0", "3.4.0", "3.4.0") | ||
99 | def email_resend_confirmation(self): | ||
100 | """ | ||
101 | Requests a re-send of the users confirmation mail for an unconfirmed logged in user. | ||
102 | |||
103 | Only available to the app that the user originally signed up with. | ||
104 | """ | ||
105 | self.__api_request('POST', '/api/v1/emails/confirmations') | ||
diff --git a/mastodon/internals.py b/mastodon/internals.py index 415e22d..4ee2c5b 100644 --- a/mastodon/internals.py +++ b/mastodon/internals.py | |||
@@ -656,3 +656,14 @@ class Mastodon(): | |||
656 | elif base_url.startswith("https://") or base_url.startswith("onion://"): | 656 | elif base_url.startswith("https://") or base_url.startswith("onion://"): |
657 | base_url = base_url[8:] | 657 | base_url = base_url[8:] |
658 | return base_url | 658 | return base_url |
659 | |||
660 | def __normalize_version_string(self, version_string): | ||
661 | # Split off everything after the first space, to take care of Pleromalikes so that the parser doesn't get confused in case those have a + somewhere in their version | ||
662 | version_string = version_string.split(" ")[0] | ||
663 | try: | ||
664 | # Attempt to split at + and check if the part after parses as a version string, to account for hometown | ||
665 | parse_version_string(version_string.split("+")[1]) | ||
666 | return version_string.split("+")[1] | ||
667 | except: | ||
668 | # If this fails, assume that if there is a +, what is before that is the masto version (or that there is no +) | ||
669 | return version_string.split("+")[0] \ No newline at end of file | ||
diff --git a/mastodon/versions.py b/mastodon/versions.py new file mode 100644 index 0000000..bf439b4 --- /dev/null +++ b/mastodon/versions.py | |||
@@ -0,0 +1,40 @@ | |||
1 | |||
2 | # versions.py - versioning of return values | ||
3 | |||
4 | from .utility import max_version | ||
5 | |||
6 | # Dict versions | ||
7 | _DICT_VERSION_APPLICATION = "2.7.2" | ||
8 | _DICT_VERSION_MENTION = "1.0.0" | ||
9 | _DICT_VERSION_MEDIA = "3.2.0" | ||
10 | _DICT_VERSION_ACCOUNT = "3.3.0" | ||
11 | _DICT_VERSION_POLL = "2.8.0" | ||
12 | _DICT_VERSION_STATUS = max_version("3.1.0", _DICT_VERSION_MEDIA, _DICT_VERSION_ACCOUNT, _DICT_VERSION_APPLICATION, _DICT_VERSION_MENTION, _DICT_VERSION_POLL) | ||
13 | _DICT_VERSION_INSTANCE = max_version("3.4.0", _DICT_VERSION_ACCOUNT) | ||
14 | _DICT_VERSION_HASHTAG = "2.3.4" | ||
15 | _DICT_VERSION_EMOJI = "3.0.0" | ||
16 | _DICT_VERSION_RELATIONSHIP = "3.3.0" | ||
17 | _DICT_VERSION_NOTIFICATION = max_version("3.5.0", _DICT_VERSION_ACCOUNT, _DICT_VERSION_STATUS) | ||
18 | _DICT_VERSION_CONTEXT = max_version("1.0.0", _DICT_VERSION_STATUS) | ||
19 | _DICT_VERSION_LIST = "2.1.0" | ||
20 | _DICT_VERSION_CARD = "3.2.0" | ||
21 | _DICT_VERSION_SEARCHRESULT = max_version("1.0.0", _DICT_VERSION_ACCOUNT, _DICT_VERSION_STATUS, _DICT_VERSION_HASHTAG) | ||
22 | _DICT_VERSION_ACTIVITY = "2.1.2" | ||
23 | _DICT_VERSION_REPORT = "2.9.1" | ||
24 | _DICT_VERSION_PUSH = "2.4.0" | ||
25 | _DICT_VERSION_PUSH_NOTIF = "2.4.0" | ||
26 | _DICT_VERSION_FILTER = "2.4.3" | ||
27 | _DICT_VERSION_CONVERSATION = max_version("2.6.0", _DICT_VERSION_ACCOUNT, _DICT_VERSION_STATUS) | ||
28 | _DICT_VERSION_SCHEDULED_STATUS = max_version("2.7.0", _DICT_VERSION_STATUS) | ||
29 | _DICT_VERSION_PREFERENCES = "2.8.0" | ||
30 | _DICT_VERSION_ADMIN_ACCOUNT = max_version("4.0.0", _DICT_VERSION_ACCOUNT) | ||
31 | _DICT_VERSION_FEATURED_TAG = "3.0.0" | ||
32 | _DICT_VERSION_MARKER = "3.0.0" | ||
33 | _DICT_VERSION_REACTION = "3.1.0" | ||
34 | _DICT_VERSION_ANNOUNCEMENT = max_version("3.1.0", _DICT_VERSION_REACTION) | ||
35 | _DICT_VERSION_STATUS_EDIT = "3.5.0" | ||
36 | _DICT_VERSION_FAMILIAR_FOLLOWERS = max_version("3.5.0", _DICT_VERSION_ACCOUNT) | ||
37 | _DICT_VERSION_ADMIN_DOMAIN_BLOCK = "4.0.0" | ||
38 | _DICT_VERSION_ADMIN_MEASURE = "3.5.0" | ||
39 | _DICT_VERSION_ADMIN_DIMENSION = "3.5.0" | ||
40 | _DICT_VERSION_ADMIN_RETENTION = "3.5.0" \ No newline at end of file | ||