.. _main_page:
prawcore
========
.. image:: https://img.shields.io/pypi/v/prawcore.svg
:alt: Latest prawcore Version
:target: https://pypi.python.org/pypi/prawcore
.. image:: https://travis-ci.org/praw-dev/prawcore.svg?branch=main
:target: https://travis-ci.org/praw-dev/prawcore
.. image:: https://coveralls.io/repos/github/praw-dev/prawcore/badge.svg?branch=main
:target: https://coveralls.io/github/praw-dev/prawcore?branch=main
prawcore is a low-level communication layer used by PRAW 4+.
Installation
------------
Install prawcore using ``pip`` via:
.. code-block:: console
pip install prawcore
Execution Example
-----------------
The following example demonstrates how to use prawcore to obtain the list of trophies
for a given user using the script-app type. This example assumes you have the
environment variables ``PRAWCORE_CLIENT_ID`` and ``PRAWCORE_CLIENT_SECRET`` set to the
appropriate values for your application.
.. code-block:: python
#!/usr/bin/env python
import os
import pprint
import prawcore
authenticator = prawcore.TrustedAuthenticator(
prawcore.Requestor("YOUR_VALID_USER_AGENT"),
os.environ["PRAWCORE_CLIENT_ID"],
os.environ["PRAWCORE_CLIENT_SECRET"],
)
authorizer = prawcore.ReadOnlyAuthorizer(authenticator)
authorizer.refresh()
with prawcore.session(authorizer) as session:
pprint.pprint(session.request("GET", "/api/v1/user/bboe/trophies"))
Save the above as ``trophies.py`` and then execute via:
.. code-block:: console
python trophies.py
Additional examples can be found at:
https://github.com/praw-dev/prawcore/tree/main/examples
Depending on prawcore
---------------------
prawcore follows `semantic versioning <http://semver.org/>`_ with the exception that
deprecations will not be preceded by a minor release. In essense, expect only major
versions to introduce breaking changes to prawcore's public interface. As a result, if
you depend on prawcore then it is a good idea to specify not only the minimum version of
prawcore your package requires, but to also limit the major version.
Below are two examples of how you may want to specify your prawcore dependency:
setup.py
~~~~~~~~
.. code-block:: python
setup(..., install_requires=["prawcore >=0.1, <1"], ...)
requirements.txt
~~~~~~~~~~~~~~~~
.. code-block:: text
prawcore >=1.5.1, <2
Raw data
{
"_id": null,
"home_page": "https://github.com/praw-dev/prawcore",
"name": "prawcore",
"maintainer": "",
"docs_url": null,
"requires_python": "~=3.6",
"maintainer_email": "",
"keywords": "praw reddit api",
"author": "Bryce Boe",
"author_email": "bbzbryce@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ed/85/13e76be737f3159514cce609b29e95499ba6d2cfa0b88761bab318b5f63e/prawcore-2.3.0.tar.gz",
"platform": "",
"description": ".. _main_page:\n\nprawcore\n========\n\n.. image:: https://img.shields.io/pypi/v/prawcore.svg\n :alt: Latest prawcore Version\n :target: https://pypi.python.org/pypi/prawcore\n\n.. image:: https://travis-ci.org/praw-dev/prawcore.svg?branch=main\n :target: https://travis-ci.org/praw-dev/prawcore\n\n.. image:: https://coveralls.io/repos/github/praw-dev/prawcore/badge.svg?branch=main\n :target: https://coveralls.io/github/praw-dev/prawcore?branch=main\n\nprawcore is a low-level communication layer used by PRAW 4+.\n\nInstallation\n------------\n\nInstall prawcore using ``pip`` via:\n\n.. code-block:: console\n\n pip install prawcore\n\nExecution Example\n-----------------\n\nThe following example demonstrates how to use prawcore to obtain the list of trophies\nfor a given user using the script-app type. This example assumes you have the\nenvironment variables ``PRAWCORE_CLIENT_ID`` and ``PRAWCORE_CLIENT_SECRET`` set to the\nappropriate values for your application.\n\n.. code-block:: python\n\n #!/usr/bin/env python\n import os\n import pprint\n import prawcore\n\n authenticator = prawcore.TrustedAuthenticator(\n prawcore.Requestor(\"YOUR_VALID_USER_AGENT\"),\n os.environ[\"PRAWCORE_CLIENT_ID\"],\n os.environ[\"PRAWCORE_CLIENT_SECRET\"],\n )\n authorizer = prawcore.ReadOnlyAuthorizer(authenticator)\n authorizer.refresh()\n\n with prawcore.session(authorizer) as session:\n pprint.pprint(session.request(\"GET\", \"/api/v1/user/bboe/trophies\"))\n\nSave the above as ``trophies.py`` and then execute via:\n\n.. code-block:: console\n\n python trophies.py\n\nAdditional examples can be found at:\nhttps://github.com/praw-dev/prawcore/tree/main/examples\n\nDepending on prawcore\n---------------------\n\nprawcore follows `semantic versioning <http://semver.org/>`_ with the exception that\ndeprecations will not be preceded by a minor release. In essense, expect only major\nversions to introduce breaking changes to prawcore's public interface. As a result, if\nyou depend on prawcore then it is a good idea to specify not only the minimum version of\nprawcore your package requires, but to also limit the major version.\n\nBelow are two examples of how you may want to specify your prawcore dependency:\n\nsetup.py\n~~~~~~~~\n\n.. code-block:: python\n\n setup(..., install_requires=[\"prawcore >=0.1, <1\"], ...)\n\nrequirements.txt\n~~~~~~~~~~~~~~~~\n\n.. code-block:: text\n\n prawcore >=1.5.1, <2\n\n\n",
"bugtrack_url": null,
"license": "Simplified BSD License",
"summary": "Low-level communication layer for PRAW 4+.",
"version": "2.3.0",
"split_keywords": [
"praw",
"reddit",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "4aa4624554bbe737552fb9d75696ede2",
"sha256": "48c17db447fa06a13ca3e722201f443031437708daa736c05a1df895fbcceff5"
},
"downloads": -1,
"filename": "prawcore-2.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4aa4624554bbe737552fb9d75696ede2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.6",
"size": 16189,
"upload_time": "2021-07-26T22:57:54",
"upload_time_iso_8601": "2021-07-26T22:57:54.177308Z",
"url": "https://files.pythonhosted.org/packages/d6/36/55cc2cab22aafbebd52ddac4ccb670b920b54eb6ddbdb8573c79ca870d8a/prawcore-2.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "c787afb47fee78ca1a04f706f5468090",
"sha256": "daf1ccd4b7a80dc4e6567d48336d782e94a9a6dad83770fc2edf76dc9a84f56d"
},
"downloads": -1,
"filename": "prawcore-2.3.0.tar.gz",
"has_sig": false,
"md5_digest": "c787afb47fee78ca1a04f706f5468090",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.6",
"size": 1163513,
"upload_time": "2021-07-26T22:57:55",
"upload_time_iso_8601": "2021-07-26T22:57:55.941556Z",
"url": "https://files.pythonhosted.org/packages/ed/85/13e76be737f3159514cce609b29e95499ba6d2cfa0b88761bab318b5f63e/prawcore-2.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-07-26 22:57:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "praw-dev",
"github_project": "prawcore",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "prawcore"
}