pixiv-api


Namepixiv-api JSON
Version 0.3.6 PyPI version JSON
download
home_pagehttps://github.com/azuline/pixiv-api
SummaryA library for the Pixiv API.
upload_time2020-10-18 17:26:41
maintainer
docs_urlNone
authorazuline
requires_python>=3.6,<4.0
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =========
pixiv-api
=========

|PyPI| |Pyversions| |Docs|

.. |PyPI| image:: https://img.shields.io/pypi/v/pixiv-api.svg
   :target: https://pypi.python.org/pypi/pixiv-api
.. |Pyversions| image:: https://img.shields.io/pypi/pyversions/pixiv-api.svg
   :target: https://pypi.python.org/pypi/pixiv-api
.. |Docs| image:: https://readthedocs.org/projects/pixiv-api/badge/?version=latest
   :target: https://pixiv-api.readthedocs.io/en/latest/?badge=latest

A library for the Pixiv API. Uses Pixiv's App API.

Install with:

.. code-block:: bash

   $ pip install pixiv-api

Quickstart
==========

To start making requests to the Pixiv API, instantiate a client object.

.. code-block:: python

   from pixivapi import Client

   client = Client()

The client can be authenticated to Pixiv's API in multiple ways. One is by
logging in with a username and password:

.. code-block:: python

   client.login('username', 'password')

And another is with a refresh token.

.. code-block:: python

   client.authenticate('refresh_token')

Once authenticated, a refresh token can be saved for future authorizations.

.. code-block:: python

   refresh_token = client.refresh_token

After authenticating, the client can begin making requests to all of the
Pixiv endpoints. For example, the following code block downloads an
image from Pixiv.

.. code-block:: python

   from pathlib import Path
   from pixivapi import Size

   illustration = client.fetch_illustration(75523989)
   illustration.download(
       directory=Path.home() / 'my_pixiv_images',
       size=Size.ORIGINAL,
   )

And the next code block downloads all illustrations of an artist.

.. code-block:: python

   from pathlib import Path
   from pixivapi import Size

   artist_id = 2188232
   directory = Path.home() / 'wlop'

   response = client.fetch_user_illustrations(artist_id)
   while True:
       for illust in response['illustrations']:
           illust.download(directory=directory, size=Size.ORIGINAL)

       if not response['next']:
           break

       response = client.fetch_user_illustrations(
           artist_id,
           offset=response['next'],
       )

Read the complete documentation at https://pixiv-api.readthedocs.io.

Changelog
=========

v0.3.6
------

- Fix inability to login.

v0.3.5
------

- Fix issue with offset not working in `fetch_illustrations_following`.

v0.3.4
------

- Fix issue with Python 3.6 compatibility wrt. datetime module.

v0.3.3
------

- Fix arguments of Novel class instantiation.

v0.3.1
------

- Fix quickstart example documentation.

v0.3.0
------

- Update authentication in response to Pixiv's changes.

v0.2.0
------

- Change ``Client.account`` from a dict to an ``Account`` model.
- Remove ``None`` attributes from User that only applied to responses from
  ``Client.fetch_user`` and move them to a ``FullUser`` subclass.
- Change return type of ``Client.fetch_user`` to a ``FullUser``. No attributes
  were changed.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/azuline/pixiv-api",
    "name": "pixiv-api",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "azuline",
    "author_email": "azuline@riseup.net",
    "download_url": "https://files.pythonhosted.org/packages/29/a0/f3080c0d75f27e8c648f53f1319462eff19b09c1f2788cd273f94cd32df4/pixiv-api-0.3.6.tar.gz",
    "platform": "",
    "description": "=========\npixiv-api\n=========\n\n|PyPI| |Pyversions| |Docs|\n\n.. |PyPI| image:: https://img.shields.io/pypi/v/pixiv-api.svg\n   :target: https://pypi.python.org/pypi/pixiv-api\n.. |Pyversions| image:: https://img.shields.io/pypi/pyversions/pixiv-api.svg\n   :target: https://pypi.python.org/pypi/pixiv-api\n.. |Docs| image:: https://readthedocs.org/projects/pixiv-api/badge/?version=latest\n   :target: https://pixiv-api.readthedocs.io/en/latest/?badge=latest\n\nA library for the Pixiv API. Uses Pixiv's App API.\n\nInstall with:\n\n.. code-block:: bash\n\n   $ pip install pixiv-api\n\nQuickstart\n==========\n\nTo start making requests to the Pixiv API, instantiate a client object.\n\n.. code-block:: python\n\n   from pixivapi import Client\n\n   client = Client()\n\nThe client can be authenticated to Pixiv's API in multiple ways. One is by\nlogging in with a username and password:\n\n.. code-block:: python\n\n   client.login('username', 'password')\n\nAnd another is with a refresh token.\n\n.. code-block:: python\n\n   client.authenticate('refresh_token')\n\nOnce authenticated, a refresh token can be saved for future authorizations.\n\n.. code-block:: python\n\n   refresh_token = client.refresh_token\n\nAfter authenticating, the client can begin making requests to all of the\nPixiv endpoints. For example, the following code block downloads an\nimage from Pixiv.\n\n.. code-block:: python\n\n   from pathlib import Path\n   from pixivapi import Size\n\n   illustration = client.fetch_illustration(75523989)\n   illustration.download(\n       directory=Path.home() / 'my_pixiv_images',\n       size=Size.ORIGINAL,\n   )\n\nAnd the next code block downloads all illustrations of an artist.\n\n.. code-block:: python\n\n   from pathlib import Path\n   from pixivapi import Size\n\n   artist_id = 2188232\n   directory = Path.home() / 'wlop'\n\n   response = client.fetch_user_illustrations(artist_id)\n   while True:\n       for illust in response['illustrations']:\n           illust.download(directory=directory, size=Size.ORIGINAL)\n\n       if not response['next']:\n           break\n\n       response = client.fetch_user_illustrations(\n           artist_id,\n           offset=response['next'],\n       )\n\nRead the complete documentation at https://pixiv-api.readthedocs.io.\n\nChangelog\n=========\n\nv0.3.6\n------\n\n- Fix inability to login.\n\nv0.3.5\n------\n\n- Fix issue with offset not working in `fetch_illustrations_following`.\n\nv0.3.4\n------\n\n- Fix issue with Python 3.6 compatibility wrt. datetime module.\n\nv0.3.3\n------\n\n- Fix arguments of Novel class instantiation.\n\nv0.3.1\n------\n\n- Fix quickstart example documentation.\n\nv0.3.0\n------\n\n- Update authentication in response to Pixiv's changes.\n\nv0.2.0\n------\n\n- Change ``Client.account`` from a dict to an ``Account`` model.\n- Remove ``None`` attributes from User that only applied to responses from\n  ``Client.fetch_user`` and move them to a ``FullUser`` subclass.\n- Change return type of ``Client.fetch_user`` to a ``FullUser``. No attributes\n  were changed.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A library for the Pixiv API.",
    "version": "0.3.6",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "561f7b8980233fa6144168ec71752722",
                "sha256": "d988497bf9879c4b14c9a704f9a85cbff88d4487bba49b913efd9a83a8456b88"
            },
            "downloads": -1,
            "filename": "pixiv_api-0.3.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "561f7b8980233fa6144168ec71752722",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<4.0",
            "size": 17860,
            "upload_time": "2020-10-18T17:26:43",
            "upload_time_iso_8601": "2020-10-18T17:26:43.885184Z",
            "url": "https://files.pythonhosted.org/packages/1b/22/e5945fc072ae198f538a21d04fd94ed70559246dac067186b8ca0011c1a6/pixiv_api-0.3.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "680b1cfec7167939abd3a88b004f8ace",
                "sha256": "5edcab42e55b25488fb2cc12365b2dcca027035696ba00316a4013672ed212df"
            },
            "downloads": -1,
            "filename": "pixiv-api-0.3.6.tar.gz",
            "has_sig": false,
            "md5_digest": "680b1cfec7167939abd3a88b004f8ace",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6,<4.0",
            "size": 17572,
            "upload_time": "2020-10-18T17:26:41",
            "upload_time_iso_8601": "2020-10-18T17:26:41.795391Z",
            "url": "https://files.pythonhosted.org/packages/29/a0/f3080c0d75f27e8c648f53f1319462eff19b09c1f2788cd273f94cd32df4/pixiv-api-0.3.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-10-18 17:26:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "azuline",
    "error": "Could not fetch GitHub repository",
    "lcname": "pixiv-api"
}
        
Elapsed time: 0.14432s