### Install asyncprawcore with pip Source: https://github.com/praw-dev/asyncprawcore/blob/main/README.rst Use pip to install the asyncprawcore package. ```console pip install asyncprawcore ``` -------------------------------- ### Install asyncprawcore with uv Source: https://github.com/praw-dev/asyncprawcore/blob/main/README.rst Use uv to add the asyncprawcore package to your project. ```console uv add asyncprawcore ``` -------------------------------- ### Specify asyncprawcore dependency in setup.py Source: https://github.com/praw-dev/asyncprawcore/blob/main/README.rst Example of how to specify asyncprawcore version constraints in a setup.py file. ```python setup(..., install_requires=["asyncprawcore >=0.1, <1"], ...) ``` -------------------------------- ### Specify asyncprawcore dependency in requirements.txt Source: https://github.com/praw-dev/asyncprawcore/blob/main/README.rst Example of how to specify asyncprawcore version constraints in a requirements.txt file. ```text asyncprawcore >=1.5.1, <2 ``` -------------------------------- ### Fetch User Trophies with asyncprawcore Source: https://github.com/praw-dev/asyncprawcore/blob/main/README.rst Demonstrates fetching a user's trophies using asyncprawcore. Requires PRAWCORE_CLIENT_ID and PRAWCORE_CLIENT_SECRET environment variables to be set. Ensure a valid user agent is provided. ```python import os import pprint import asyncio import asyncprawcore async def main(): authenticator = asyncprawcore.TrustedAuthenticator( client_id=os.environ["PRAWCORE_CLIENT_ID"], client_secret=os.environ["PRAWCORE_CLIENT_SECRET"], requestor=asyncprawcore.Requestor(user_agent="YOUR_VALID_USER_AGENT"), ) authorizer = asyncprawcore.ReadOnlyAuthorizer(authenticator=authenticator) await authorizer.refresh() async with asyncprawcore.session(authorizer=authorizer) as session: pprint.pprint( await session.request(method="GET", path="/api/v1/user/bboe/trophies") ) if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### asyncprawcore.sessions.session Source: https://github.com/praw-dev/asyncprawcore/blob/main/docs/code_overview/sessions.rst The session helper function is the recommended way to construct a Session object, which ties an authorizer to a requestor for API communication. ```APIDOC ## asyncprawcore.sessions.session ### Description Constructs and returns a :class:`.Session` object. This object is used to manage API requests by associating an authorizer with a requestor. ### Function Signature `asyncprawcore.sessions.session(authorizer, requestor)` ### Parameters #### Path Parameters * **authorizer** (:class:`.Authorizer`) - Required - The authorizer object to use for authentication. * **requestor** (:class:`.Requestor`) - Required - The requestor object to use for making HTTP requests. ### Returns * (:class:`.Session`) - A new Session object configured with the provided authorizer and requestor. ``` -------------------------------- ### asyncprawcore.sessions.Session.request Source: https://github.com/praw-dev/asyncprawcore/blob/main/docs/code_overview/sessions.rst The request method is the primary interface for making HTTP requests to the Reddit API using the configured authorizer and requestor. ```APIDOC ## asyncprawcore.sessions.Session.request ### Description Makes an HTTP request to the Reddit API. ### Method This is a method of the :class:`.Session` object. ### Parameters * **kwargs** - Additional keyword arguments to be passed to the underlying request function. ### Returns * (:class:`.Response`) - The response object from the HTTP request. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.