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:
Arguments:
name
- site's name (see Module "sites" page);access_token
- access token;app_key
- application key.
get
get
Signature:
Returns raw result of calling query
to API.
post
post
Auth required
Signature:
Returns raw result of POST-calling query
to API.
add_answer
add_answer
Auth required
Signature:
Create a new answer on the given question.
add_answers_suggested_edit
add_answers_suggested_edit
Auth required
Signature:
Create a suggested edit on an existing answer.
add_comment
add_comment
Auth required
Signature:
Create a new comment.
add_question
add_question
Auth required
Signature:
Create a new question.
add_questions_suggested_edit
add_questions_suggested_edit
Auth required
Signature:
Create a suggested edit on an existing question.
delete_answer
delete_answer
Auth required
Signature:
Deletes an answer.
delete_comment
delete_comment
Auth required
Signature:
Deletes a comment.
delete_question
delete_question
Auth required
Signature:
Deletes a question.
edit_answer
edit_answer
Auth required
Signature:
Edits an existing answer.
edit_comment
edit_comment
Auth required
Signature:
Edits an existing comment.
edit_question
edit_question
Auth required
Signature:
Edits an existing question.
get_answers
get_answers
Signature:
Returns, if ids
is set, all the undeleted answers in the system, else the set of answers identified by ids
.
get_answer
get_answer
Signature:
Returns answer identified by a_id
. Returns None
if requested object don't found.
get_answers_on_collectives
get_answers_on_collectives
Signature:
Returns answers belonging to collectives in slugs
found on the site.
get_answers_on_questions
get_answers_on_questions
Signature:
Returns the answers to a set of questions identified by ids
.
get_articles
get_articles
Signature:
Returns, if ids
is set, all articles on the site, else the articles identified by ids
.
get_article
get_article
Signature:
Returns article identified by a_id
. Returns None
if requested object don't found.
get_badges
get_badges
Signature:
Returns all badges in the system.
get_badges_recipients
get_badges_recipients
Signature:
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_badges
Signature:
Returns the badges that are awarded for participation in specific tags.
get_non_tag_based_badges
get_non_tag_based_badges
Signature:
Returns all non-tagged-based badges in alphabetical order.
get_collectives
get_collectives
Signature:
Returns, if slugs
is set, collectives in slugs
found on the site, else, all collectives in the system.
get_collective
get_collective
Signature:
Returns collective with specific slug
. Returns None
if requested object don't found.
get_comments
get_comments
Signature:
Returns, if ids
is set, the comments identified by ids
, else, all comments on the site.
get_comment
get_comment
Signature:
Returns the comment identified in c_id
. Returns None
if requested object don't found.
get_comments_on_answers
get_comments_on_answers
Signature:
Returns the comments on a set of answers.
get_comments_on_articles
get_comments_on_articles
Signature:
Returns the comments on a set of articles.
get_comments_on_posts
get_comments_on_posts
Signature:
Returns the comments on a set of posts.
get_comments_on_questions
get_comments_on_questions
Signature:
Returns the comments on a set of questions.
get_info
get_info
Signature:
Returns a collection of statistics about the site.
get_linked_in_articles
get_linked_in_articles
Signature:
Returns the questions that are linked to the articles identified by ids
.
get_linked_in_questions
get_linked_in_questions
Signature:
Returns questions which link to those questions identified by ids
.
get_posts
get_posts
Signature:
Returns, if ids
is set, the posts identified by ids
, else, all posts on the site.
get_post
get_post
Signature:
Returns the post identified in p_id
. Returns None
if requested object don't found.
get_privileges
get_privileges
Signature:
Returns the earnable privileges on a site.
get_questions
get_questions
Signature:
Returns, if ids
is set, all the undeleted questions in the system, else the set of questions identified by ids
.
get_question
get_question
Signature:
Returns the question identified in q_id
. Returns None
if requested object don't found.
get_questions_on_answers
get_questions_on_answers
Signature:
Returns the questions on a set of answers.
get_bountied_questions
get_bountied_questions
Signature:
Returns all the questions with active bounties in the system.
get_questions_on_collectives
get_questions_on_collectives
Signature:
Returns the questions on a set of collectives.
get_questions_with_no_answers
get_questions_with_no_answers
Signature:
Returns questions which have received no answers.
get_related_to_questions
get_related_to_questions
Signature:
Returns questions that the site considers related to those identified by ids
.
get_unanswered_questions
get_unanswered_questions
Signature:
Returns questions the site considers to be unanswered.
get_unanswered_questions_on_my_tags
get_unanswered_questions_on_my_tags
Auth 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_revisions
Signature:
Returns edit revisions identified by ids
.
get_revisions_on_posts
get_revisions_on_posts
Signature:
Returns revisions on the set of posts, identified by ids
.
search
search
Signature:
Searches a site for any questions which fit the given criteria.
Warning: one of
tagged
orintitle
keyword arguments must be set.
advanced_search
advanced_search
Signature:
Searches a site for any questions which fit the given criteria.
get_similar
get_similar
Signature:
Returns questions which are similar to a hypothetical one based on a title and tag combination.
get_suggested_edits
get_suggested_edits
Signature:
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_posts
Signature:
Returns suggested edits on the set of posts, identified by ids
.
get_tags
get_tags
Signature:
Returns all tags in the system.
get_top_answerers_on_tag
get_top_answerers_on_tag
Signature:
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_tag
Signature:
Returns the top 20 askers active in a given tag
, of either all-time or the last 30 days.
get_tags_wikis
get_tags_wikis
Signature:
Returns the wikis that go with the given set of tags in tags
.
get_tags_on_collectives
get_tags_on_collectives
Signature:
Returns tags belonging to collectives in slugs
found on the site.
get_tags_info
get_tags_info
Signature:
Returns tags' info from the tags
found on the site.
get_tags_faq
get_tags_faq
Signature:
Returns the frequently asked questions for the given set of tags in tags
.
get_me
get_me
Auth required
Signature:
Returns the user associated with the passed access_token
.
get_moderator_only_tags
get_moderator_only_tags
Signature:
Returns the tags found on a site that only moderators can use.
get_my_full_reputation_history
get_my_full_reputation_history
Auth required
Signature:
Returns user's full reputation history, including private events.
get_my_inbox
get_my_inbox
Auth required
Signature:
Returns the user identified by access_token
's inbox.
get_my_unread_inbox
get_my_unread_inbox
Auth required
Signature:
Returns the unread items in the user identified by access_token
's inbox.
get_related_tags
get_related_tags
Signature:
Returns the tags that are most related to those in tags
.
get_required_tags
get_required_tags
Signature:
Returns the tags found on a site that fulfill required tag constraints on questions.
get_tags_synonyms
get_tags_synonyms
Signature:
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_timeline
Signature:
Returns a subset of the events that have happened to the questions identified by ids
.
get_users
get_users
Signature:
Returns, if ids
is set, the users identified by ids
, else all users on a site.
get_user
get_user
Signature:
Returns the user identified in uid
. Returns None
if requested object don't found.
get_users_answers
get_users_answers
Signature:
Returns the answers the users in ids
have posted.
get_users_badges
get_users_badges
Signature:
Returns the badges the users in ids
have earned.
get_users_on_collectives
get_users_on_collectives
Signature:
Returns users belonging to collectives in slugs
found on the site.
get_users_comments
get_users_comments
Signature:
Returns the comments posted by users in ids
.
get_users_comments_to
get_users_comments_to
Signature:
Returns the comments that the users in ids
have posted in reply to the single user identified in toid
.
get_users_favorites
get_users_favorites
Signature:
Returns the questions that users in ids
have bookmarked.
get_users_mentions
get_users_mentions
Signature:
Returns all the comments that the users in ids
were mentioned in.
get_users_posts
get_users_posts
Signature:
Returns the posts the users in ids
have posted.
get_user_privileges
get_user_privileges
Signature:
Returns the privileges a user with ID uid
has.
get_users_questions
get_users_questions
Signature:
Returns the questions asked by the users in ids
.
get_users_unaccepted_questions
get_users_unaccepted_questions
Signature:
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_questions
Signature:
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_questions
Signature:
Returns the questions on which the users in {ids} have active bounties.
get_users_questions_with_no_answers
get_users_questions_with_no_answers
Signature:
Returns the questions asked by the users in ids
which have no answers.
get_users_reputation
get_users_reputation
Signature:
Returns a subset of the reputation changes for users in {ids}.
get_users_reputation_history
get_users_reputation_history
Signature:
Returns users' public reputation history.
get_users_suggested_edits
get_users_suggested_edits
Signature:
Returns the suggested edits that the users in ids
have submitted.
get_users_tags
get_users_tags
Signature:
Returns the tags the users identified in ids
have been active in.
get_user_top_answers_on_tags
get_user_top_answers_on_tags
Signature:
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_tags
Signature:
Returns the top 30 questions a user has asked with the given tags.
get_users_timeline
get_users_timeline
Signature:
Returns a subset of the actions the users in ids
have taken on the site.
get_user_top_answers_tags
get_user_top_answers_tags
Signature:
Returns a single user's top tags by answer score.
get_user_top_questions_tags
get_user_top_questions_tags
Signature:
Returns a single user's top tags by question score.
get_user_top_tags
get_user_top_tags
Signature:
Returns a single user's top tags by combined question and answer score.
get_moderators
get_moderators
Signature:
Returns those users on a site who can exercise moderation powers.
get_elected_moderators
get_elected_moderators
Signature:
Returns those users on a site who both have moderator powers, and were actually elected.
Last updated