# Path: simple_monitor_alert/sma.py
# def get_var_directory():
#     var_directory = DEFAULT_VAR_DIRECTORY
#     if validate_write_dir(var_directory, logger.warning):
#         return var_directory
#     for candidate in [os.path.expanduser('~/.local/var/lib/simple-monitor-alert'), '/tmp/simple-monitor-alert']:
#         if validate_write_dir(candidate):
#             logger.info('Usign {} directory for var content, but {} is recommended.'.format(candidate, var_directory))
#             return candidate
#     import getpass
#     raise OSError('{} is not writable by {} user'.format(var_directory, getpass.getuser()))


import getpass
import os
import sys
import webbrowser
import json
import requests
import time
from json.decoder import JSONDecodeError
from simple_monitor_alert.sma import get_var_directory
#!/usr/bin/env python
"""Google Cloud Print Monitor
Send an alert if printers are offline.

Run this script first with the "register" parameter:
sudo -u sma ./google-cloud-print.py register
"""



GRANT_TYPE = 'http://oauth.net/grant_type/device/1.0'
GRANT_TYPE_REFRESH = 'refresh_token'
SCOPE = 'https://www.googleapis.com/auth/cloudprint'
REGISTER_NEW_PROJECT_URL = 'https://console.developers.google.com/iam-admin/projects'
OAUTH_DEVICE_CODE_URL = 'https://accounts.google.com/o/oauth2/device/code'
OAUTH_TOKEN_URL = 'https://www.googleapis.com/oauth2/v4/token'
SEARCH_PRINTS = 'https://www.google.com/cloudprint/search'


# Path: simple_monitor_alert/sma.py
# def get_var_directory():
#     var_directory = DEFAULT_VAR_DIRECTORY
#     if validate_write_dir(var_directory, logger.warning):
#         return var_directory
#     for candidate in [os.path.expanduser('~/.local/var/lib/simple-monitor-alert'), '/tmp/simple-monitor-alert']:
#         if validate_write_dir(candidate):
#             logger.info('Usign {} directory for var content, but {} is recommended.'.format(candidate, var_directory))
#             return candidate
#     import getpass
#     raise OSError('{} is not writable by {} user'.format(var_directory, getpass.getuser()))


# Path: monitors/google-cloud-print.py
import getpass
import os
import sys
import webbrowser
import json
import requests
import time
from json.decoder import JSONDecodeError
from simple_monitor_alert.sma import get_var_directory

#!/usr/bin/env python
"""Google Cloud Print Monitor
Send an alert if printers are offline.

Run this script first with the "register" parameter:
sudo -u sma ./google-cloud-print.py register
"""



GRANT_TYPE = 'http://oauth.net/grant_type/device/1.0'
GRANT_TYPE_REFRESH = 'refresh_token'
SCOPE = 'https://www.googleapis.com/auth/cloudprint'
REGISTER_NEW_PROJECT_URL = 'https://console.developers.google.com/iam-admin/projects'
OAUTH_DEVICE_CODE_URL = 'https://accounts.google.com/o/oauth2/device/code'
OAUTH_TOKEN_URL = 'https://www.googleapis.com/oauth2/v4/token'
SEARCH_PRINTS = 'https://www.google.com/cloudprint/search'


var_directory = get_var_directory()