How to use the apraw.const.API_PATH function in aPRAW

To help you get started, we’ve selected a few aPRAW examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Dan6erbond / aPRAW / apraw / models / mixins / spoilerable.py View on Github external
async def spoiler(self):
        """
        Mark the item as a spoiler.

        Returns
        -------
        resp: Dict
            The API response JSON.
        """
        return await self.reddit.post_request(API_PATH["post_spoiler"], id=self.fullname)
github Dan6erbond / aPRAW / apraw / models / subreddit / subreddit.py View on Github external
Send a message to the subreddit.

        Parameters
        ----------
        subject: str
            The message subject.
        text: str
            The message contents as markdown.
        from_sr: str or Subreddit
            The subreddit the message is being sent from if applicable.
        Returns
        -------
        response: Dict
            The API response JSON as a dictionary.
        """
        return await self._reddit.message(API_PATH["subreddit"].format(sub=self.display_name), subject, text,
                                          str(from_sr))
github Dan6erbond / aPRAW / apraw / models / helpers / item_moderation.py View on Github external
async def unignore_reports(self):
        """
        Unignore previously ignored reports on the Reddit item.

        Returns
        -------
        resp: Dict
            The API response JSON.
        """
        return await self.reddit.post_request(API_PATH["mod_unignore_reports"], id=self.fullname)
github Dan6erbond / aPRAW / apraw / models / subreddit / wiki.py View on Github external
async def revert(self, revision: Union[str, 'WikipageRevision']):
        resp = await self.subreddit._reddit.post_request(
            API_PATH["wiki_revert"].format(sub=self.subreddit), data={
                "page": self.name,
                "revision": str(revision)
            })
        return resp if resp else True
github Dan6erbond / aPRAW / apraw / models / mixins / votable.py View on Github external
async def downvote(self):
        """
        Downvote the item.

        Returns
        -------
        resp: Dict
            The API response JSON.
        """
        return await self.reddit.post_request(API_PATH["post_vote"], id=self.fullname, dir=-1)
github Dan6erbond / aPRAW / apraw / models / subreddit / modmail.py View on Github external
async def conversations(self) -> 'ModmailConversation':
        """
        Retrieve a list of modmail conversations.

        Yields
        ------
        conversation: ModmailConversation
            A modmail conversation held in the subreddit.
        """
        req = await self.subreddit.reddit.get_request(API_PATH["modmail_conversations"],
                                                      entity=self.subreddit.display_name)
        for id in req["conversations"]:
            yield ModmailConversation(self.subreddit.reddit, req["conversations"][id])
github Dan6erbond / aPRAW / apraw / models / mixins / nsfwable.py View on Github external
async def unmark_nsfw(self):
        """
        Unmark the item as NSFW.

        Returns
        -------
        resp: Dict
            The API response JSON.
        """
        return await self.reddit.post_request(API_PATH["post_unmarknsfw"], id=self.fullname)
github Dan6erbond / aPRAW / apraw / models / subreddit / moderation.py View on Github external
for comment in subreddit.mod.edited.stream():
                    print(comment)

        Parameters
        ----------
        kwargs: \*\*Dict
            :class:`~apraw.models.ListingGenerator` ``kwargs``.

        Returns
        -------
        generator: ListingGenerator
            A :class:`~apraw.models.ListingGenerator` mapped to grab edited items.
        """
        from ..helpers.generator import ListingGenerator
        return ListingGenerator(self.subreddit._reddit,
                                API_PATH["subreddit_edited"].format(sub=self.subreddit.display_name),
                                subreddit=self.subreddit, *args, **kwargs)
github Dan6erbond / aPRAW / apraw / models / mixins / deletable.py View on Github external
async def delete(self):
        """
        Delete the item.

        Returns
        -------
        resp: Dict
            The API response JSON.
        """
        return await self.reddit.post_request(API_PATH["post_delete"], id=self.fullname)
github Dan6erbond / aPRAW / apraw / models / reddit / comment.py View on Github external
async def show_comment(self):
        """
        Mark a comment that it should not be collapsed because of crowd control.

        The comment could still be collapsed for other reasons.

        Returns
        -------
        resp: Dict
            The API response JSON.
        """
        return await self.reddit.post_request(API_PATH["mod_show_comment"], id=self.fullname)