API reference

pixiv.login(username, password, session=None)[source]
class pixiv.Pixiv(session=None)[source]

Bases: pixiv.pixiv.Authed

Store session data

login(username, password)[source]

Logs the user into Pixiv.

Parameters:
  • username (str) – login name
  • password (str) – password for the login
search(terms, period='all', order='asc')[source]

Search pixiv and return a list of Work objects.

Parameters:
  • terms (str) – search terms
  • period (str) – period to search over. This must be one of 'all', 'day', 'week' or 'month'
  • order (str) – sort order to list results. This must be either 'asc' or 'desc'
user(user_id)[source]

Return a User object for a particular Pixiv user.

Parameters:user_id (int) – ID of the user
Return type:User
work(work_id)[source]

Return a Work object with a specified ID.

Parameters:work_id (int) – ID of the artwork
Return type:Work
class pixiv.User(id, auth_token=None, session=None)[source]

Bases: pixiv.pixiv.BaseUser, pixiv.pixiv.Authed

A Pixiv user

Parameters:id (int) – the id of this user
works()[source]

Return a list of Work created by this user

class pixiv.Work(id, auth_token=None, session=None)[source]

Bases: pixiv.pixiv.Authed

A Pixiv artwork

Parameters:

id (int) – the id of this work

Variables:
  • id (int) – ID of this work
  • image (str) – URL of the large size image for this work
  • width (int) – width of image
  • height (int) – height of image
  • tags – list of tags this image has been tagged with
classmethod from_api_data(api_data, auth_token=None, session=None)[source]

Return a new instance populated with data from the API

save(filename=None)[source]

Save this artwork to a local file

Parameters:filename (str) – the filename to save to. If this is None, then the image will be named with the default from the pixiv site, e.g. 1234567_p0.jpg
Returns:the filename the image was saved to
Return type:str