CONFIG and SSL
This commit is contained in:
parent
8caff8cdc0
commit
793092ddc8
@ -37,19 +37,34 @@ Usage:
|
|||||||
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import requests
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from plexapi.server import PlexServer
|
from plexapi.server import PlexServer, CONFIG
|
||||||
|
|
||||||
|
MESSAGE = "GET TO BED!"
|
||||||
|
|
||||||
PLEX_URL = 'http://localhost:32400'
|
PLEX_URL = ''
|
||||||
PLEX_TOKEN = 'xxxxxx'
|
PLEX_TOKEN = ''
|
||||||
plex = PlexServer(PLEX_URL, PLEX_TOKEN)
|
PLEX_URL = CONFIG.data['auth'].get('server_baseurl', PLEX_URL)
|
||||||
|
PLEX_TOKEN = CONFIG.data['auth'].get('server_token', PLEX_TOKEN)
|
||||||
|
|
||||||
|
sess = requests.Session()
|
||||||
|
# Ignore verifying the SSL certificate
|
||||||
|
sess.verify = False # '/path/to/certfile'
|
||||||
|
# If verify is set to a path to a directory,
|
||||||
|
# the directory must have been processed using the c_rehash utility supplied
|
||||||
|
# with OpenSSL.
|
||||||
|
if sess.verify is False:
|
||||||
|
# Disable the warning that the request is insecure, we know that...
|
||||||
|
import urllib3
|
||||||
|
|
||||||
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
|
plex = PlexServer(PLEX_URL, PLEX_TOKEN, session=sess)
|
||||||
|
|
||||||
user_lst = [x.title for x in plex.myPlexAccount().users()]
|
user_lst = [x.title for x in plex.myPlexAccount().users()]
|
||||||
sections_lst = [x.title for x in plex.library.sections()]
|
sections_lst = [x.title for x in plex.library.sections()]
|
||||||
|
|
||||||
MESSAGE = "GET TO BED!"
|
|
||||||
|
|
||||||
|
|
||||||
def share(user, libraries):
|
def share(user, libraries):
|
||||||
plex.myPlexAccount().updateFriend(user=user, server=plex, sections=libraries)
|
plex.myPlexAccount().updateFriend(user=user, server=plex, sections=libraries)
|
||||||
|
Loading…
Reference in New Issue
Block a user