Beispiel #1
0
    def validateToken(self, token, switchUser=False):
        self.authToken = token
        self.switchUser = switchUser

        request = myplexrequest.MyPlexRequest("/users/sign_in.xml")
        context = request.createRequestContext(
            "sign_in", callback.Callable(self.onAccountResponse))
        if self.isOffline:
            context.timeout = self.isOffline and asyncadapter.AsyncTimeout(
                1).setConnectTimeout(1)
        plexapp.APP.startRequest(request, context, {})
Beispiel #2
0
import socket
import threadutils
import urllib
import mimetypes
import plexobjects
from xml.etree import ElementTree

import asyncadapter

import callback
import util

codes = requests.codes
status_codes = requests.status_codes._codes

DEFAULT_TIMEOUT = asyncadapter.AsyncTimeout(10).setConnectTimeout(10)


def GET(*args, **kwargs):
    return requests.get(*args,
                        headers=util.BASE_HEADERS.copy(),
                        timeout=util.TIMEOUT,
                        **kwargs)


def POST(*args, **kwargs):
    return requests.post(*args,
                         headers=util.BASE_HEADERS.copy(),
                         timeout=util.TIMEOUT,
                         **kwargs)