Skip to main content

Get your Pixiv token (for running upbit/pixivpy)

Project description

gppt: get-pixivpy-token

PyPI Docker Image Size (latest by date) Maintainability pre-commit.ci status

Install

pip install gppt

Run

Retrieved token can be used like below:

from pixivpy3 import AppPixivAPI

REFRESH_TOKEN = "***"  # or, REFRESH_TOKEN = res.refresh_token

aapi = AppPixivAPI()
aapi.auth(refresh_token=REFRESH_TOKEN)
...

From Docker

$ docker run --rm -it eggplanter/gppt lh -u <id> -p <pw>
[+]: Success!
access_token: ***
refresh_token: ***
expires_in: 3600

From CLI

  • Note: In advance, please setup google-chrome-stable + selenium + webdriver
# with browser
$ gppt login
[!]: Chrome browser will be launched. Please login.
(Log in to Pixiv from the login screen that starts up.)
[+]: Success!
access_token: ***
refresh_token: ***
expires_in: 3600
...

# with headless browser
$ gppt login-headless -u <id> -p <pw>
[!]: Chrome browser will be launched. Please login.
[+]: Success!
access_token: ***
refresh_token: ***
expires_in: 3600

From Library

  • Note: In advance, please setup google-chrome-stable + selenium + webdriver
from gppt import GetPixivToken
g = GetPixivToken()
res = g.login(headless=True, user="...", pass_="...")
  • res.response returns
{
  "access_token": "***",
  "expires_in": 3600,
  "refresh_token": "***",
  "scope": "",
  "token_type": "bearer",
  "user": {
    "account": "***",
    "id": "***",
    "is_mail_authorized": <bool>,
    "is_premium": <bool>,
    "mail_address": "***@***",
    "name": "***",
    "profile_image_urls": {
      "px_16x16": "https://s.pximg.net/common/images/no_profile_ss.png",
      "px_170x170": "https://s.pximg.net/common/images/no_profile.png",
      "px_50x50": "https://s.pximg.net/common/images/no_profile_s.png"
    },
    "require_policy_agreement": <bool>,
    "x_restrict": 2
  }
}

Help

$ gppt -h
usage: gppt [-h]
            {login,l,login-interactive,li,login-headless,lh,refresh,r} ...

Get your Pixiv token (for running upbit/pixivpy)

positional arguments:
  {login,l,login-interactive,li,login-headless,lh,refresh,r}
    login (l)           retrieving auth token
    login-interactive (li)
                        `login` in interactive mode
    login-headless (lh)
                        `login` in headless mode
    refresh (r)         refresh tokens

optional arguments:
  -h, --help            show this help message and exit
$ gppt l -h
usage: gppt login [-h] [-u USERNAME] [-p PASSWORD] [-j]

optional arguments:
  -h, --help            show this help message and exit
  -u USERNAME, --username USERNAME
                        your E-mail address / pixiv ID
  -p PASSWORD, --password PASSWORD
                        your current pixiv password
  -j, --json            output response as json
$ gppt li -h
usage: gppt login-interactive [-h] [-j]

optional arguments:
  -h, --help  show this help message and exit
  -j, --json  output response as json
$ gppt lh -h
usage: gppt login-headless [-h] -u USERNAME -p PASSWORD [-j]

optional arguments:
  -h, --help            show this help message and exit
  -u USERNAME, --username USERNAME
                        your E-mail address / pixiv ID
  -p PASSWORD, --password PASSWORD
                        your current pixiv password
  -j, --json            output response as json
$ gppt r -h
usage: gppt refresh [-h] [-j] refresh_token

positional arguments:
  refresh_token

optional arguments:
  -h, --help     show this help message and exit
  -j, --json     output response as json

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

gppt-2.1.1.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

gppt-2.1.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file gppt-2.1.1.tar.gz.

File metadata

  • Download URL: gppt-2.1.1.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for gppt-2.1.1.tar.gz
Algorithm Hash digest
SHA256 ad9a0f68a9bb0088cbf9def8d292faeab930081d3083fa3e7781fd60af30ec4c
MD5 0a479ffff71412932871e1821fc3abfa
BLAKE2b-256 3f7de90efd63b593869555a675abe6786b8a38ce97035bae03f783b8cd28be34

See more details on using hashes here.

File details

Details for the file gppt-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: gppt-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for gppt-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dff2804405d4ba263e6aa012fe9a72b3094cea914fb0bacf4539b3b0b5423778
MD5 2c1016b58b31224ca36ce1e7ce1646f9
BLAKE2b-256 2cacd57b239e61459666ce83c41c2330fcd00e4feeb6a5f6aa351ac8942aed61

See more details on using hashes here.

Supported by

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