Skip to main content

A library for the Pixiv API.

Project description

PyPI Pyversions Docs

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

Install with:

$ pip install pixiv-api

Quickstart

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

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:

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

And another is with a refresh token.

client.authenticate('refresh_token')

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

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.

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.

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.7

  • Add ability to specify tags when adding a bookmark.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pixiv-api-0.3.7.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pixiv_api-0.3.7-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file pixiv-api-0.3.7.tar.gz.

File metadata

  • Download URL: pixiv-api-0.3.7.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.6 Linux/5.10.1-1-default

File hashes

Hashes for pixiv-api-0.3.7.tar.gz
Algorithm Hash digest
SHA256 4401b280e175b6d31c70dc95787c4497db9bf7b7f8f64cdd33206e9788311930
MD5 a8d639f8a73a30337b2ae10de589b3b9
BLAKE2b-256 ab765e7745db6a8055c396061c1dc8f8176f0346ac1fba5b35cf5fb76ed9f24b

See more details on using hashes here.

File details

Details for the file pixiv_api-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: pixiv_api-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.6 Linux/5.10.1-1-default

File hashes

Hashes for pixiv_api-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b549dd7594c36dfbc33456fb872d3520865d81c2988c727695e69b12d7c49744
MD5 ca473a40e1f3ef475f89ead96f34d17b
BLAKE2b-256 33196ba3da14859b6211d69a51fb25ca0437a88c9583f462fced522f9daf6525

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page