Skip to main content

A simple interface to enable/disable your NS

Project description

Here a simple script to enable/disable your NS. This is the equiv of toggling the “Disable Alarms for Today” in the app.

import os
import json

from ns_parental_controls import ParentalControl


def save(**k):
    with open('test.json', 'wt') as file:
        file.write(json.dumps(k, indent=2))


def load(**k):
    if not os.path.isfile('test.json'):
        return k

    try:
        with open('test.json', 'rt') as file:
            return json.load(file)
    except Exception as e:
        print(e)
        return k


pc = ParentalControl(
    save_state_callback=save,
    load_state_callback=load,
    callback_kwargs={'random': 'kwargs'}
)

if not pc.access_token:
    if not pc.session_token:
        print(pc.get_auth_url())
        pc.process_auth_link(input('copy paste the button link "select this account" here:\n'))
    else:
        pc.get_new_access_token()

# True means disable the NS
# False means enable the NS
pc.lock_device('My NS', False)

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

ns_parental_controls-1.3.1.tar.gz (8.1 kB view details)

Uploaded Source

File details

Details for the file ns_parental_controls-1.3.1.tar.gz.

File metadata

  • Download URL: ns_parental_controls-1.3.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for ns_parental_controls-1.3.1.tar.gz
Algorithm Hash digest
SHA256 561677dd320448114ba65fa76b07fc1e4aabbb30d25b16ddeea5e76c693557a9
MD5 58336bd0787c8b7a09001dabe3f0ddbf
BLAKE2b-256 5775c0d6f8e05bf970ab73a2d9c95ce0c90c93ee7085a01e727377f030c9438e

See more details on using hashes here.

Supported by

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