Class "Site"
Implements the StackExchange APIs client for a specific site.
Note #1: the **kwargs argument in methods is necessary for request parameters, like pagesize, order, etc.
Note #2: The Item class in the methods return type hint is a standard dict class with the ability to get values not only using the d['key'] construction, but also d.key.
Methods:
__init__
__init__Signature:
__init__(self, name: str, access_token: str | None = None,
app_key: str | None = None) -> NoneArguments:
name- site's name (see Module "sites" page);access_token- access token;app_key- application key.
get
getSignature:
get(self, query: str, **kwargs: Any) -> dictReturns raw result of calling query to API.
post
postAuth required
Signature:
Returns raw result of POST-calling query to API.
add_answer
add_answerAuth required
Signature:
Create a new answer on the given question.
add_answers_suggested_edit
add_answers_suggested_editAuth required
Signature:
Create a suggested edit on an existing answer.
add_comment
add_commentAuth required
Signature:
Create a new comment.
add_question
add_questionAuth required
Signature:
Create a new question.
add_questions_suggested_edit
add_questions_suggested_editAuth required
Signature:
Create a suggested edit on an existing question.
delete_answer
delete_answerAuth required
Signature:
Deletes an answer.
delete_comment
delete_commentAuth required
Signature:
Deletes a comment.
delete_question
delete_questionAuth required
Signature:
Deletes a question.
edit_answer
edit_answerAuth required
Signature:
Edits an existing answer.
edit_comment
edit_commentAuth required
Signature:
Edits an existing comment.
edit_question
edit_questionAuth required
Signature:
Edits an existing question.
get_answers
get_answersSignature:
Returns, if ids is set, all the undeleted answers in the system, else the set of answers identified by ids.
get_answer
get_answerSignature:
Returns answer identified by a_id. Returns None if requested object don't found.
get_answers_on_collectives
get_answers_on_collectivesSignature:
Returns answers belonging to collectives in slugs found on the site.
get_answers_on_questions
get_answers_on_questionsSignature:
Returns the answers to a set of questions identified by ids.
get_articles
get_articlesSignature:
Returns, if ids is set, all articles on the site, else the articles identified by ids.
get_article
get_articleSignature:
Returns article identified by a_id. Returns None if requested object don't found.
get_badges
get_badgesSignature:
Returns all badges in the system.
get_badges_recipients
get_badges_recipientsSignature:
Returns, if ids is set, recently awarded badges in the system, constrained to a certain set of badges, else recently awarded badges in the system.
get_tag_based_badges
get_tag_based_badgesSignature:
Returns the badges that are awarded for participation in specific tags.
get_non_tag_based_badges
get_non_tag_based_badgesSignature:
Returns all non-tagged-based badges in alphabetical order.
get_collectives
get_collectivesSignature:
Returns, if slugs is set, collectives in slugs found on the site, else, all collectives in the system.
get_collective
get_collectiveSignature:
Returns collective with specific slug. Returns None if requested object don't found.
get_comments
get_commentsSignature:
Returns, if ids is set, the comments identified by ids, else, all comments on the site.
get_comment
get_commentSignature:
Returns the comment identified in c_id. Returns None if requested object don't found.
get_comments_on_answers
get_comments_on_answersSignature:
Returns the comments on a set of answers.
get_comments_on_articles
get_comments_on_articlesSignature:
Returns the comments on a set of articles.
get_comments_on_posts
get_comments_on_postsSignature:
Returns the comments on a set of posts.
get_comments_on_questions
get_comments_on_questionsSignature:
Returns the comments on a set of questions.
get_info
get_infoSignature:
Returns a collection of statistics about the site.
get_linked_in_articles
get_linked_in_articlesSignature:
Returns the questions that are linked to the articles identified by ids.
get_linked_in_questions
get_linked_in_questionsSignature:
Returns questions which link to those questions identified by ids.
get_posts
get_postsSignature:
Returns, if ids is set, the posts identified by ids, else, all posts on the site.
get_post
get_postSignature:
Returns the post identified in p_id. Returns None if requested object don't found.
get_privileges
get_privilegesSignature:
Returns the earnable privileges on a site.
get_questions
get_questionsSignature:
Returns, if ids is set, all the undeleted questions in the system, else the set of questions identified by ids.
get_question
get_questionSignature:
Returns the question identified in q_id. Returns None if requested object don't found.
get_questions_on_answers
get_questions_on_answersSignature:
Returns the questions on a set of answers.
get_bountied_questions
get_bountied_questionsSignature:
Returns all the questions with active bounties in the system.
get_questions_on_collectives
get_questions_on_collectivesSignature:
Returns the questions on a set of collectives.
get_questions_with_no_answers
get_questions_with_no_answersSignature:
Returns questions which have received no answers.
get_related_to_questions
get_related_to_questionsSignature:
Returns questions that the site considers related to those identified by ids.
get_unanswered_questions
get_unanswered_questionsSignature:
Returns questions the site considers to be unanswered.
get_unanswered_questions_on_my_tags
get_unanswered_questions_on_my_tagsAuth required
Signature:
Returns questions the site considers to be unanswered, which are within a user's favorite tags.
If a user has no favorites, their frequented tags are used instead.
get_revisions
get_revisionsSignature:
Returns edit revisions identified by ids.
get_revisions_on_posts
get_revisions_on_postsSignature:
Returns revisions on the set of posts, identified by ids.
search
searchSignature:
Searches a site for any questions which fit the given criteria.
Warning: one of
taggedorintitlekeyword arguments must be set.
advanced_search
advanced_searchSignature:
Searches a site for any questions which fit the given criteria.
get_similar
get_similarSignature:
Returns questions which are similar to a hypothetical one based on a title and tag combination.
get_suggested_edits
get_suggested_editsSignature:
Returns, if ids is set, the suggested edits identified by ids, else all suggested edits on the site.
get_suggested_edits_on_posts
get_suggested_edits_on_postsSignature:
Returns suggested edits on the set of posts, identified by ids.
get_tags
get_tagsSignature:
Returns all tags in the system.
get_top_answerers_on_tag
get_top_answerers_on_tagSignature:
Returns the top 20 answerers active in a given tag, of either all-time or the last 30 days.
get_top_askers_on_tag
get_top_askers_on_tagSignature:
Returns the top 20 askers active in a given tag, of either all-time or the last 30 days.
get_tags_wikis
get_tags_wikisSignature:
Returns the wikis that go with the given set of tags in tags.
get_tags_on_collectives
get_tags_on_collectivesSignature:
Returns tags belonging to collectives in slugs found on the site.
get_tags_info
get_tags_infoSignature:
Returns tags' info from the tags found on the site.
get_tags_faq
get_tags_faqSignature:
Returns the frequently asked questions for the given set of tags in tags.
get_me
get_meAuth required
Signature:
Returns the user associated with the passed access_token.
get_moderator_only_tags
get_moderator_only_tagsSignature:
Returns the tags found on a site that only moderators can use.
get_my_full_reputation_history
get_my_full_reputation_historyAuth required
Signature:
Returns user's full reputation history, including private events.
get_my_inbox
get_my_inboxAuth required
Signature:
Returns the user identified by access_token's inbox.
get_my_unread_inbox
get_my_unread_inboxAuth required
Signature:
Returns the unread items in the user identified by access_token's inbox.
get_related_tags
get_related_tagsSignature:
Returns the tags that are most related to those in tags.
get_required_tags
get_required_tagsSignature:
Returns the tags found on a site that fulfill required tag constraints on questions.
get_tags_synonyms
get_tags_synonymsSignature:
Returns, if tags is set, all the synonyms that point to the tags identified in tags, else all tag synonyms found on the site.
get_questions_timeline
get_questions_timelineSignature:
Returns a subset of the events that have happened to the questions identified by ids.
get_users
get_usersSignature:
Returns, if ids is set, the users identified by ids, else all users on a site.
get_user
get_userSignature:
Returns the user identified in uid. Returns None if requested object don't found.
get_users_answers
get_users_answersSignature:
Returns the answers the users in ids have posted.
get_users_badges
get_users_badgesSignature:
Returns the badges the users in ids have earned.
get_users_on_collectives
get_users_on_collectivesSignature:
Returns users belonging to collectives in slugs found on the site.
get_users_comments
get_users_commentsSignature:
Returns the comments posted by users in ids.
get_users_comments_to
get_users_comments_toSignature:
Returns the comments that the users in ids have posted in reply to the single user identified in toid.
get_users_favorites
get_users_favoritesSignature:
Returns the questions that users in ids have bookmarked.
get_users_mentions
get_users_mentionsSignature:
Returns all the comments that the users in ids were mentioned in.
get_users_posts
get_users_postsSignature:
Returns the posts the users in ids have posted.
get_user_privileges
get_user_privilegesSignature:
Returns the privileges a user with ID uid has.
get_users_questions
get_users_questionsSignature:
Returns the questions asked by the users in ids.
get_users_unaccepted_questions
get_users_unaccepted_questionsSignature:
Returns the questions asked by the users in ids which have at least one answer, but no accepted answer.
get_users_unanswered_questions
get_users_unanswered_questionsSignature:
Returns the questions asked by the users in ids which the site considers unanswered, while still having at least one answer posted.
get_users_bountied_questions
get_users_bountied_questionsSignature:
Returns the questions on which the users in {ids} have active bounties.
get_users_questions_with_no_answers
get_users_questions_with_no_answersSignature:
Returns the questions asked by the users in ids which have no answers.
get_users_reputation
get_users_reputationSignature:
Returns a subset of the reputation changes for users in {ids}.
get_users_reputation_history
get_users_reputation_historySignature:
Returns users' public reputation history.
get_users_suggested_edits
get_users_suggested_editsSignature:
Returns the suggested edits that the users in ids have submitted.
get_users_tags
get_users_tagsSignature:
Returns the tags the users identified in ids have been active in.
get_user_top_answers_on_tags
get_user_top_answers_on_tagsSignature:
Returns the top 30 answers a user has posted in response to questions with the given tags.
get_user_top_questions_on_tags
get_user_top_questions_on_tagsSignature:
Returns the top 30 questions a user has asked with the given tags.
get_users_timeline
get_users_timelineSignature:
Returns a subset of the actions the users in ids have taken on the site.
get_user_top_answers_tags
get_user_top_answers_tagsSignature:
Returns a single user's top tags by answer score.
get_user_top_questions_tags
get_user_top_questions_tagsSignature:
Returns a single user's top tags by question score.
get_user_top_tags
get_user_top_tagsSignature:
Returns a single user's top tags by combined question and answer score.
get_moderators
get_moderatorsSignature:
Returns those users on a site who can exercise moderation powers.
get_elected_moderators
get_elected_moderatorsSignature:
Returns those users on a site who both have moderator powers, and were actually elected.
Last updated