skpy/conn.py
def auth(self, url, name):
        """
        Connect to Skype as a guest, joining a given conversation.

        In this state, some APIs (such as contacts) will return 401 status codes.  A guest can only communicate with
        the conversation they originally joined.

        Args:
            url (str): public join URL for conversation, or identifier from it
            name (str): display name as shown to other participants

        Returns:
            (str, datetime.datetime) tuple: Skype token, and associated expiry if known

        Raises:
            .SkypeAuthException: if the login request is rejected
            .SkypeApiException: if the login form can't be processed
        """
        urlId = url.split("/")[-1]
        # Pretend to be Chrome on Windows (required to avoid "unsupported device" messages).
        agent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " \
                "Chrome/33.0.1750.117 Safari/537.36"
        cookies = self.conn("GET", "{0}/{1}".format(SkypeConnection.API_JOIN, urlId),
                            headers={"User-Agent": agent}).cookies
        ids = self.conn("POST", "{0}/api/v2/conversation/".format(SkypeConnection.API_JOIN),
                        json={"shortId": urlId, "type": "wl"}).json()
        token = self.conn("POST", "{0}/api/v1/users/guests".format(SkypeConnection.API_JOIN),
                          headers={"csrf_token": cookies.get("csrf_token"),
                                   "X-Skype-Request-Id": cookies.get("launcher_session_id")},
                          json={"flowId": cookies.get("launcher_session_id"),
                                "shortId": urlId,
                                "longId": ids.get("Long"),
                                "threadId": ids.get("Resource"),
                                "name": name}).json().get("skypetoken")
        # Assume the token lasts 24 hours, as a guest account only lasts that long anyway.
        expiry = datetime.now() + timedelta(days=1)
        return token, expiry
def auth(self, url, name):
        """
        Connect to Skype as a guest, joining a given conversation.

        In this state, some APIs (such as contacts) will return 401 status codes.  A guest can only communicate with
        the conversation they originally joined.

        Args:
            url (str): public join URL for conversation, or identifier from it
            name (str): display name as shown to other participants

        Returns:
            (str, datetime.datetime) tuple: Skype token, and associated expiry if known

        Raises:
            .SkypeAuthException: if the login request is rejected
            .SkypeApiException: if the login form can't be processed
        """
        urlId = url.split("/")[-1]
        # Pretend to be Chrome on Windows (required to avoid "unsupported device" messages).
        agent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " \
                "Chrome/33.0.1750.117 Safari/537.36"
        cookies = self.conn("GET", "{0}/{1}".format(SkypeConnection.API_JOIN, urlId),
                            headers={"User-Agent": agent}).cookies
        ids = self.conn("POST", "{0}/api/v2/conversation/".format(SkypeConnection.API_JOIN),
                        json={"shortId": urlId, "type": "wl"}).json()
        token = self.conn("POST", "{0}/api/v1/users/guests".format(SkypeConnection.API_JOIN),
                          headers={"csrf_token": cookies.get("csrf_token"),
                                   "X-Skype-Request-Id": cookies.get("launcher_session_id")},
                          json={"flowId": cookies.get("launcher_session_id"),
                                "shortId": urlId,
                                "longId": ids.get("Long"),
                                "threadId": ids.get("Resource"),
                                "name": name}).json().get("skypetoken")
        # Assume the token lasts 24 hours, as a guest account only lasts that long anyway.
        expiry = datetime.now() + timedelta(days=1)
        return token, expiry
def auth ( self , url , name ) : urlId = url . split ( "/" ) [ - 1 ] # Pretend to be Chrome on Windows (required to avoid "unsupported device" messages). agent = "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/33.0.1750.117 Safari/537.36" cookies = self . conn ( "GET" , "{0}/{1}" . format ( SkypeConnection . API_JOIN , urlId ) , headers = { "User-Agent" : agent } ) . cookies ids = self . conn ( "POST" , "{0}/api/v2/conversation/" . format ( SkypeConnection . API_JOIN ) , json = { "shortId" : urlId , "type" : "wl" } ) . json ( ) token = self . conn ( "POST" , "{0}/api/v1/users/guests" . format ( SkypeConnection . API_JOIN ) , headers = { "csrf_token" : cookies . get ( "csrf_token" ) , "X-Skype-Request-Id" : cookies . get ( "launcher_session_id" ) } , json = { "flowId" : cookies . get ( "launcher_session_id" ) , "shortId" : urlId , "longId" : ids . get ( "Long" ) , "threadId" : ids . get ( "Resource" ) , "name" : name } ) . json ( ) . get ( "skypetoken" ) # Assume the token lasts 24 hours, as a guest account only lasts that long anyway. expiry = datetime . now ( ) + timedelta ( days = 1 ) return token , expiry
Connect to Skype as a guest, joining a given conversation.

        In this state, some APIs (such as contacts) will return 401 status codes.  A guest can only communicate with
        the conversation they originally joined.

        Args:
            url (str): public join URL for conversation, or identifier from it
            name (str): display name as shown to other participants

        Returns:
            (str, datetime.datetime) tuple: Skype token, and associated expiry if known

        Raises:
            .SkypeAuthException: if the login request is rejected
            .SkypeApiException: if the login form can't be processed
Connect to Skype as a guest joining a given conversation .