Get your Pixiv token (for running upbit/pixivpy)
Project description
gppt: get-pixivpy-token
- Get your Pixiv token (for running upbit/pixivpy)
- Refine pixiv_auth.py + its fork
Install
pip install gppt
Enable Proxy
Set ALL_PROXY or HTTPS_PROXY to your environment variables.
Run
Example
from gppt import GetPixivToken
from pixivpy3 import AppPixivAPI
def get_refresh_token() -> str:
with open("token.txt", "w+") as f:
if refresh_token := f.read().strip():
return refresh_token
g = GetPixivToken(headless=True)
refresh_token = g.login(username="...", password="...")["refresh_token"]
f.write(refresh_token)
return refresh_token
aapi = AppPixivAPI()
aapi.auth(refresh_token=get_refresh_token())
...
From Docker
$ docker run --rm -it ghcr.io/eggplants/get-pixivpy-token lh -u <id> -p <pw>
[+]: Success!
access_token: ***
refresh_token: ***
expires_in: 3600
From CLI
# 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
from gppt import GetPixivToken
g = GetPixivToken(headless=False,username=None,password=None)
res = g.login(headless=None,username=None,password=None)
res.responsereturns:
{
"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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gppt-4.3.0.tar.gz
(10.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
gppt-4.3.0-py3-none-any.whl
(12.4 kB
view details)
File details
Details for the file gppt-4.3.0.tar.gz.
File metadata
- Download URL: gppt-4.3.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e560669e1a53adbf57b8ff0a55bbab0f589d0b4da37f7eecb1496a8da7232e7b
|
|
| MD5 |
720b9b29b50ac396a47cea9a179fbe54
|
|
| BLAKE2b-256 |
0f33477a0571e1608c11024d9b142bb4a0b2ebaf8272194cd1ea2fd2bcd9c60c
|
File details
Details for the file gppt-4.3.0-py3-none-any.whl.
File metadata
- Download URL: gppt-4.3.0-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.24 {"installer":{"name":"uv","version":"0.9.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
173dd4a5f84f734b204c52d4e5392958e7b66968160bec73bf4929c816e8f745
|
|
| MD5 |
e24cb0ba06c880e66542b842e6e225fb
|
|
| BLAKE2b-256 |
0c074edae7bbde2e0f729dfc3f06de430c9ccdec4e0c5e6de9b2bf944058485c
|