gppt: get-pixivpy-token
- Get your Pixiv token (for running upbit/pixivpy)
- Refine pixiv_auth.py + its fork
Install
pip install gppt
CLI
# Configure a profile (writes to: ~/.config/gppt/<profile>.json by default)
gppt configure
# Log in (writes to: ~/.config/gppt/<profile>.token.json by default)
gppt login
~/.config/gppt/<profile>.json:
{
"username": "<plain username or op:// link>",
"password": "<plain password or op:// link>",
"totp_secret": "<base32 secret, otpauth:// URI, or op:// link>",
"auth_method": "e2e" // or "oauth"
}
~/.config/gppt/<profile>.token.json:
{
"access_token": "***",
"refresh_token": "***",
"expires_in": 3600,
"expires_at": "2026-08-08T16:34:57.776005+00:00",
"user_id": "***",
"user_name": "***",
"user_account": "***"
}
Environment variables
| Variable | Effect |
|---|---|
GPPT_USERNAME, GPPT_PASSWORD, GPPT_TOTP_SECRET |
Override the profile's credentials — lets a container or CI job log in with no config file |
GPPT_AUTH_METHOD |
Override the profile's authentication method (e2e or oauth) |
GPPT_CONFIG_DIR |
Directory holding profiles and cached tokens (default: $XDG_CONFIG_HOME/gppt) |
ALL_PROXY, HTTPS_PROXY, HTTP_PROXY |
Proxy used by both the browser and the token requests |
Library
gppt.get_token() is the library form of gppt login: it reuses the cached
token, refreshes it, or logs in — by the profile's method — if needed.
import gppt
from pixivpy3 import AppPixivAPI
token = gppt.get_token() # profile "default", configured with `gppt configure`
aapi = AppPixivAPI()
aapi.auth(refresh_token=token.refresh_token)
It is silent by default; pass notify=print to see the same progress messages
the CLI writes.
gppt.oauth_login() is the OAuth2 PKCE flow as a library call — it prints the
login URL, opens it, and reads the pasted code from stdin. No credentials, no
files:
token = gppt.oauth_login()
Point it at your own UI with prompt= and notify=, and pass open_browser=False to only print the URL.
For a one-off login that reads and writes nothing on disk, use gppt.login():
token = gppt.login(username="...", password="...")
token.access_token, token.refresh_token, token.expires_in
For a 2FA account, pass the TOTP secret — or a totp_prompt callable that is
invoked only if pixiv asks for a code:
token = gppt.login("...", "...", "JBSWY3DPEHPK3PXP")
token = gppt.login("...", "...", totp_prompt=lambda: input("code: "))
And gppt.refresh() exchanges a refresh token you are storing yourself:
token = gppt.refresh("...")
| Name | Purpose |
|---|---|
gppt.get_token(profile="default", *, method=None, headless=True, force=False, save=True, notify=None, totp_prompt=None) |
A valid token for a stored profile, logging in only if needed. method is "e2e", "oauth", or None for whatever the profile says |
gppt.login(username="", password="", totp_secret="", *, headless=None, totp_prompt=None) |
One browser login; no files touched |
gppt.oauth_login(*, open_browser=True, prompt=None, notify=None) |
One OAuth2 PKCE login — you paste the code; no files touched |
gppt.refresh(refresh_token) |
Refresh token → new token |
gppt.Token |
Result dataclass: access_token, refresh_token, expires_in, expires_at, is_expired, user_id, user_name, user_account |
gppt.LoginError, gppt.TokenError |
Raised when a login yields no authorization code / pixiv rejects the request |
Metadata
Release files for gppt 5.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gppt-5.1.1.tar.gz | 20.1 kB | Without provenance | Details for gppt-5.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gppt-5.1.1-py3-none-any.whl | Python 3 | none | any | Details for gppt-5.1.1-py3-none-any.whl |
Total release size: 44.3 kB
Release files / gppt-5.1.1.tar.gz
| Download URL | gppt-5.1.1.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c1b9217f6b5f90e04b5072b9b68549450c139ea4498023ea61fcc2d144be5ee8
|
|
BLAKE2b-256 checksum How to use checksums |
d6e8f2e285216154ae860f7fdb45735fea06a4040f92f52083e14405f8031e20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / gppt-5.1.1-py3-none-any.whl
| Download URL | gppt-5.1.1-py3-none-any.whl |
|---|---|
| Size | 24.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cbaad491a8512b445403576d4ac5a953645e47694d03fad4a359a587062ecb08
|
|
BLAKE2b-256 checksum How to use checksums |
fad42584ac71661521013b4f4bea53fff34e27cbd87525b0544cbe958b34fdf0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for gppt 5.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.