Python client for the PlayStation Family (PSN parental controls) API
Project description
psnfamily
Async Python client for the PlayStation Family parental-controls API — the
cloud API behind Sony's PS Family mobile app (com.playstation.ohana.android).
It lets you read your family roster, children's online presence and now-playing
game, and read and change a child's daily play-time limit, plus content and
communication parental controls.
⚠️ Unofficial. Reverse-engineered from the PS Family Android app; not affiliated with or endorsed by Sony. The API is undocumented and may change or break at any time. Excessive use may risk your PSN account — the client self-limits to 1 request / 3 s. Use at your own risk.
For turnkey use the library ships the PS Family app's own OAuth client credentials (the ones carrying the
mobile:familyscope), recovered from the app. Sony may rotate or revoke these at any time, which would require an update. You can override them viaOAuthClient(...).
Auth
PSN uses OAuth; this library authenticates headlessly with an npsso cookie:
- Sign in at https://www.playstation.com as the Family Manager account.
- Open https://ca.account.sony.com/api/v1/ssocookie — copy the 64-char
npssovalue. - Pass it to
OhanaClient.authenticate(npsso). The library exchanges it for an access token (~1 h) and a refresh token (~60 days) and refreshes automatically. Persistclient.tokensto avoid re-entering the npsso.
Usage
import asyncio
from psnfamily import OhanaClient
async def main():
async with OhanaClient() as client:
await client.authenticate("<npsso>")
children = await client.get_children()
for child in children:
pt = await client.get_playtime(child.identity.account_id)
print(child.identity.display_name,
"limit", pt.today_limit_seconds, "used", pt.used_today_seconds)
kid = children[0]
# Set a 2-hour daily play-time limit:
await client.set_daily_limit(kid.member_id, 2 * 3600)
# Remove the limit (unlimited):
await client.set_daily_limit(kid.member_id, None)
asyncio.run(main())
Play-time is governed by a recurring weekly schedule of
PlaytimeDaySetting { maxPlaytimeDuration, windowStart, windowEnd }.
set_daily_limit applies a uniform limit across the week (quantized to 15 min);
set_playtime_schedule gives full per-day control. Durations are ISO-8601
(PT2H, P0D = no limit); the playable-hours window is in minutes from local
midnight (full day = 0..1440).
Capabilities
authenticate(npsso)/ token refresh; persistclient.tokensto reuseget_family_members()/get_children()— roster, roles, idsget_presences(account_ids)— online status + now-playing gameget_playtime(account_id)— limits, usage, timezone, on-limit actionset_daily_limit(member_id, seconds)/set_playtime_schedule(...)— set play-time limitsget_supported_parental_controls()and other read operationsexecute(operation, variables)— any reverse-engineered operation by name
Some write operations the app contains (e.g.
updateTodaysPlaytimeLimitand theupdateParentalControlsfamily) are not in Sony's gateway allowlist for the current app version and will raisePsnFamilyApiError("not whitelisted").
Auth client
The library ships the PS Family app's OAuth client (the one carrying the
mobile:family scope), recovered from the app, analogous to how psn-api /
PSNAWP ship the public PSN mobile client. You only provide the npsso.
See research/PROTOCOL.md in the repository for the full reverse-engineering
reference and the list of facts still pending live confirmation.
License
MIT
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
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
File details
Details for the file psnfamily-0.1.0.tar.gz.
File metadata
- Download URL: psnfamily-0.1.0.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d50e1a7ef8791f8db63704173629afa6fb56789539b587e4baa2b5cf264b05a3
|
|
| MD5 |
3355c5063d3875daf73e12e9ab05d03a
|
|
| BLAKE2b-256 |
e6c4a83af17cde437783ceb1bb5714f2fa9ca65686b98c59558246bbe91f59fe
|
Provenance
The following attestation bundles were made for psnfamily-0.1.0.tar.gz:
Publisher:
workflow.yaml on parkee/psnfamily
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
psnfamily-0.1.0.tar.gz -
Subject digest:
d50e1a7ef8791f8db63704173629afa6fb56789539b587e4baa2b5cf264b05a3 - Sigstore transparency entry: 1933728435
- Sigstore integration time:
-
Permalink:
parkee/psnfamily@df996e455ca4cf22b18113310e1c5a1572ae91ed -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/parkee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yaml@df996e455ca4cf22b18113310e1c5a1572ae91ed -
Trigger Event:
push
-
Statement type:
File details
Details for the file psnfamily-0.1.0-py3-none-any.whl.
File metadata
- Download URL: psnfamily-0.1.0-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4826de03bbd1703093da6cda33ec1e0e884efe3fafd485ddbe86cb26f1eeb2a
|
|
| MD5 |
9ad2181efbaf0f6fc3a55fd25fb3240a
|
|
| BLAKE2b-256 |
41c0bf0a1deb23c09b2ec589e9320c4b9297c58f70475caefb09631055756312
|
Provenance
The following attestation bundles were made for psnfamily-0.1.0-py3-none-any.whl:
Publisher:
workflow.yaml on parkee/psnfamily
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
psnfamily-0.1.0-py3-none-any.whl -
Subject digest:
b4826de03bbd1703093da6cda33ec1e0e884efe3fafd485ddbe86cb26f1eeb2a - Sigstore transparency entry: 1933728767
- Sigstore integration time:
-
Permalink:
parkee/psnfamily@df996e455ca4cf22b18113310e1c5a1572ae91ed -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/parkee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yaml@df996e455ca4cf22b18113310e1c5a1572ae91ed -
Trigger Event:
push
-
Statement type: