Name | pyimgur JSON |
Version |
0.7.2
JSON |
| download |
home_page | None |
Summary | The easy way of using Imgur |
upload_time | 2025-03-18 22:03:36 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | None |
keywords |
pyimgur
api
imgur
wrapper
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
.. begin_intro
PyImgur
=======
.. image:: https://badge.fury.io/py/pyimgur.svg
:target: https://badge.fury.io/py/pyimgur
The simple way of using Imgur.
You can upload images, download images, read comments, update your albums,
message people and more. In fact, you can do almost everything via PyImgur that
you can via the webend.
PyImgur is a well-tested, user-friendly wrapper around the Imgur API that makes it easy to interact with Imgur's services through Python, with comprehensive documentation and clear examples. The codebase demonstrates good software engineering practices with extensive test coverage (particularly for API interactions), clear error handling, and a thoughtful pagination system. While some modernization could help (like the move to pyproject.toml), the project is actively maintained and provides a reliable, production-ready solution for developers needing to interact with Imgur programmatically.
\- Claude 3.5 Sonnet
Prompt: Consicely evaluate this project for quality, userfriendliness and usefulness. Keep your answer to 3 sentences or less.
.. end_intro
.. begin_installation
Installation
------------
The recommended way to install is via `pip <http://pypi.python.org/pypi/pip>`_.
.. code-block:: bash
$ pip install pyimgur
.. end_installation
.. begin_getting_started
Getting Started
---------------
Before we can start using PyImgur, we need to register our application with
Imgur. This way, Imgur can see what each application is doing on their site.
Go to https://api.imgur.com/oauth2/addclient to register your client.
When we registered our application we got a ``client_id`` and a
``client_secret``. The ``client_secret`` is used for authenticating as a user,
if we just need access to public or anonymous resources, then we can leave it
out. For our first example we're going to get some information about an image
already uploaded to image::
import pyimgur
CLIENT_ID = "Your_applications_client_id"
im = pyimgur.Imgur(CLIENT_ID)
image = im.get_image('S1jmapR')
print(image.title) # Cat Ying & Yang
print(image.link) # http://imgur.com/S1jmapR.jpg
The ``Imgur`` object keeps the authentication information, changes
authentication and is the common way to get objects from Imgur.
Uploading an Image
------------------
Let's use another example to show how to upload an image::
import pyimgur
CLIENT_ID = "Your_applications_client_id"
PATH = "A Filepath to an image on your computer"
im = pyimgur.Imgur(CLIENT_ID)
uploaded_image = im.upload_image(PATH, title="Uploaded with PyImgur")
print(uploaded_image.title)
print(uploaded_image.link)
print(uploaded_image.size)
print(uploaded_image.type)
Some methods here one or more arguments with the default value ``None``. For
methods modifying existing objects, this mean to keep the already existing
value. For methods not modifying existing objects, this mean to use the Imgur
default.
Testing
-------
To run the tests, you can use the following command.
.. code-block:: bash
pytest
On an unmodified download of this repository, it will run all unit tests.
These do not require an Imgur API key and include tests for API calls and
general functionality.
If you have configured a ´authentication.py´ file with your credentials,
then integration tests will also be run. Ensuring that nothing has changed
in the Imgur API, which would break functionality.
Lazy objects
------------
To reduce the load on Imgur, PyImgur only requests the data it needs. This
means each object has the attribute ``_has_fetched`` which if ``True``` has
fetched all the data it can, if ``False`` it can fetch more information.
Whenever we request an attribute that hasn't been loaded the newest information
will be requested from Imgur and all the object attributes will be updated to
the newest values. We can also use the method ``refresh()`` to force a call to
Imgur, that will update the object with the latest values::
import pyimgur
CLIENT_ID = "Your_applications_client_id"
im = pyimgur.Imgur(CLIENT_ID)
gallery_image = im.get_gallery_image('JiAaT')
author = gallery_image.author
print(author._has_fetched) # False ie. it's a lazily loaded object
print(author.reputation)
print(author._has_fetched) # True ie. all values have now been retrieved.
Introspection
-------------
Remember that as usual you can use the ``dir``, ``vars`` and ``help`` builtin
functions to introspect objects to learn more about them and how they work.
Mashape API
-----------
Imgur supports commercial use via Mashape, which uses a different endpoint and
some additional authentication. You can enable this easily by providing your
Mashape key on initialization of the Imgur object::
import pyimgur
CLIENT_ID = "Your_applications_client_id"
MASHAPE_KEY = "Your_mashape_api_key"
im = pyimgur.Imgur(CLIENT_ID, mashape_key=MASHAPE_KEY)
More information on Mashape's API and Pricing can be found on the `Mashape
website <https://market.mashape.com/imgur/imgur-9>`_.
Support
-------
If you find an bug, have any questions about how to use PyImgur or have
suggestions for improvements then feel free to file an issue on the `Github
project page <https://github.com/Damgaard/PyImgur>`_.
Documentation
-------------
PyImgur's full documentation is located on `ReadTheDocs
<https://pyimgur.readthedocs.org>`_.
License
-------
All of the code contained here is licensed by
`the GNU GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>`_.
Upcoming breaking changes
-------------------------
To avoid multiple releases with breaking changes, I will try to bulk
release breaking changes in a single release. This won't prevent future
releases with breaking changes, but will reduce the number of them.
Which will make it easier to upgrade.
- Remove Mashape key argument from Imgur object. It currently does nothing.
As Mashape is no longer used by Imgur, instead RapidAPI is used. Which
is also supported by the Imgur object.
- Fix some classes like Gallery_album not being in following PascalCase.
- Rename / remove DEFAULT_LIMIT from Imgur. Also not following conventions.
Should maybe be set via an environment variable or other config instead.
- Change to a more permissive license.
.. end_getting_started
Raw data
{
"_id": null,
"home_page": null,
"name": "pyimgur",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "PyImgur, api, imgur, wrapper",
"author": null,
"author_email": "Andreas Damgaard Pedersen <andreas.damgaard.pedersen@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/11/65/ce08f79b0e666bf532033ba3e915a9e8b176335a3a6a473485ea21c70ec2/pyimgur-0.7.2.tar.gz",
"platform": null,
"description": ".. begin_intro\n\nPyImgur\n=======\n\n.. image:: https://badge.fury.io/py/pyimgur.svg\n :target: https://badge.fury.io/py/pyimgur\n\nThe simple way of using Imgur.\n\nYou can upload images, download images, read comments, update your albums,\nmessage people and more. In fact, you can do almost everything via PyImgur that\nyou can via the webend.\n\n PyImgur is a well-tested, user-friendly wrapper around the Imgur API that makes it easy to interact with Imgur's services through Python, with comprehensive documentation and clear examples. The codebase demonstrates good software engineering practices with extensive test coverage (particularly for API interactions), clear error handling, and a thoughtful pagination system. While some modernization could help (like the move to pyproject.toml), the project is actively maintained and provides a reliable, production-ready solution for developers needing to interact with Imgur programmatically.\n \n \\- Claude 3.5 Sonnet\n\nPrompt: Consicely evaluate this project for quality, userfriendliness and usefulness. Keep your answer to 3 sentences or less.\n\n.. end_intro\n\n.. begin_installation\n\nInstallation\n------------\n\nThe recommended way to install is via `pip <http://pypi.python.org/pypi/pip>`_.\n\n.. code-block:: bash\n\n $ pip install pyimgur\n\n\n.. end_installation\n\n.. begin_getting_started\n\nGetting Started\n---------------\n\nBefore we can start using PyImgur, we need to register our application with\nImgur. This way, Imgur can see what each application is doing on their site.\nGo to https://api.imgur.com/oauth2/addclient to register your client.\n\nWhen we registered our application we got a ``client_id`` and a\n``client_secret``. The ``client_secret`` is used for authenticating as a user,\nif we just need access to public or anonymous resources, then we can leave it\nout. For our first example we're going to get some information about an image\nalready uploaded to image::\n\n import pyimgur\n CLIENT_ID = \"Your_applications_client_id\"\n im = pyimgur.Imgur(CLIENT_ID)\n image = im.get_image('S1jmapR')\n print(image.title) # Cat Ying & Yang\n print(image.link) # http://imgur.com/S1jmapR.jpg\n\nThe ``Imgur`` object keeps the authentication information, changes\nauthentication and is the common way to get objects from Imgur.\n\nUploading an Image\n------------------\n\nLet's use another example to show how to upload an image::\n\n import pyimgur\n\n CLIENT_ID = \"Your_applications_client_id\"\n PATH = \"A Filepath to an image on your computer\"\n\n im = pyimgur.Imgur(CLIENT_ID)\n uploaded_image = im.upload_image(PATH, title=\"Uploaded with PyImgur\")\n print(uploaded_image.title)\n print(uploaded_image.link)\n print(uploaded_image.size)\n print(uploaded_image.type)\n\n\nSome methods here one or more arguments with the default value ``None``. For\nmethods modifying existing objects, this mean to keep the already existing\nvalue. For methods not modifying existing objects, this mean to use the Imgur\ndefault.\n\nTesting\n-------\n\nTo run the tests, you can use the following command.\n\n.. code-block:: bash\n\n pytest\n\nOn an unmodified download of this repository, it will run all unit tests.\nThese do not require an Imgur API key and include tests for API calls and\ngeneral functionality.\n\nIf you have configured a \u00b4authentication.py\u00b4 file with your credentials,\nthen integration tests will also be run. Ensuring that nothing has changed\nin the Imgur API, which would break functionality.\n\nLazy objects\n------------\n\nTo reduce the load on Imgur, PyImgur only requests the data it needs. This\nmeans each object has the attribute ``_has_fetched`` which if ``True``` has\nfetched all the data it can, if ``False`` it can fetch more information.\n\nWhenever we request an attribute that hasn't been loaded the newest information\nwill be requested from Imgur and all the object attributes will be updated to\nthe newest values. We can also use the method ``refresh()`` to force a call to\nImgur, that will update the object with the latest values::\n\n import pyimgur\n CLIENT_ID = \"Your_applications_client_id\"\n im = pyimgur.Imgur(CLIENT_ID)\n gallery_image = im.get_gallery_image('JiAaT')\n author = gallery_image.author\n print(author._has_fetched) # False ie. it's a lazily loaded object\n print(author.reputation)\n print(author._has_fetched) # True ie. all values have now been retrieved.\n\nIntrospection\n-------------\n\nRemember that as usual you can use the ``dir``, ``vars`` and ``help`` builtin\nfunctions to introspect objects to learn more about them and how they work.\n\nMashape API\n-----------\n\nImgur supports commercial use via Mashape, which uses a different endpoint and\nsome additional authentication. You can enable this easily by providing your\nMashape key on initialization of the Imgur object::\n\n import pyimgur\n CLIENT_ID = \"Your_applications_client_id\"\n MASHAPE_KEY = \"Your_mashape_api_key\"\n im = pyimgur.Imgur(CLIENT_ID, mashape_key=MASHAPE_KEY)\n\nMore information on Mashape's API and Pricing can be found on the `Mashape\nwebsite <https://market.mashape.com/imgur/imgur-9>`_.\n\nSupport\n-------\n\nIf you find an bug, have any questions about how to use PyImgur or have\nsuggestions for improvements then feel free to file an issue on the `Github\nproject page <https://github.com/Damgaard/PyImgur>`_.\n\nDocumentation\n-------------\n\nPyImgur's full documentation is located on `ReadTheDocs\n<https://pyimgur.readthedocs.org>`_.\n\nLicense\n-------\n\nAll of the code contained here is licensed by\n`the GNU GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>`_.\n\nUpcoming breaking changes\n-------------------------\n\nTo avoid multiple releases with breaking changes, I will try to bulk\nrelease breaking changes in a single release. This won't prevent future\nreleases with breaking changes, but will reduce the number of them.\nWhich will make it easier to upgrade.\n\n- Remove Mashape key argument from Imgur object. It currently does nothing.\n As Mashape is no longer used by Imgur, instead RapidAPI is used. Which\n is also supported by the Imgur object.\n- Fix some classes like Gallery_album not being in following PascalCase.\n- Rename / remove DEFAULT_LIMIT from Imgur. Also not following conventions.\n Should maybe be set via an environment variable or other config instead.\n- Change to a more permissive license.\n\n.. end_getting_started\n",
"bugtrack_url": null,
"license": null,
"summary": "The easy way of using Imgur",
"version": "0.7.2",
"project_urls": {
"Documentation": "https://pyimgur.readthedocs.org",
"Homepage": "https://github.com/Damgaard/PyImgur"
},
"split_keywords": [
"pyimgur",
" api",
" imgur",
" wrapper"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "81a582aee14676ccdcc333bdfe20b1f371a1fcf0b00f906063a0856413dc3b47",
"md5": "2d8bfa4d5dedfca6c76b8c33302861f7",
"sha256": "f98e88491bf1d485174a0b40f7e506187b340feb2ff2339a01979aaf66d3b6f4"
},
"downloads": -1,
"filename": "pyimgur-0.7.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2d8bfa4d5dedfca6c76b8c33302861f7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 37818,
"upload_time": "2025-03-18T22:03:35",
"upload_time_iso_8601": "2025-03-18T22:03:35.013938Z",
"url": "https://files.pythonhosted.org/packages/81/a5/82aee14676ccdcc333bdfe20b1f371a1fcf0b00f906063a0856413dc3b47/pyimgur-0.7.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1165ce08f79b0e666bf532033ba3e915a9e8b176335a3a6a473485ea21c70ec2",
"md5": "61ad96f2442c22ceddb85b74c3cbdfff",
"sha256": "ebe78b65d4aed5d0cd339abe6baed4ce4aebc46bce1464976cf4733b84e39eed"
},
"downloads": -1,
"filename": "pyimgur-0.7.2.tar.gz",
"has_sig": false,
"md5_digest": "61ad96f2442c22ceddb85b74c3cbdfff",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 32703,
"upload_time": "2025-03-18T22:03:36",
"upload_time_iso_8601": "2025-03-18T22:03:36.484957Z",
"url": "https://files.pythonhosted.org/packages/11/65/ce08f79b0e666bf532033ba3e915a9e8b176335a3a6a473485ea21c70ec2/pyimgur-0.7.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-18 22:03:36",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Damgaard",
"github_project": "PyImgur",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pyimgur"
}