Exemple #1
0
def youtube(u, **kw):
    """
    Given a canonical youtube url, generate it's embed code.
    """
    kw.setdefault('width', 320)
    kw.setdefault('height', 160)

    id = url.get_query_param(u, 'v')
    if not id:
        return None

    kw['src'] = "//www.youtube.com/embed/" + id
    return VIDEO_EMBED_FORMAT.format(**kw)
Exemple #2
0
def youtube(u, **kw):
    """
    Given a canonical youtube url, generate it's embed code.
    """
    kw.setdefault('width', 320)
    kw.setdefault('height', 160)

    id = url.get_query_param(u, 'v')
    if not id:
        return None

    kw['src'] = "//www.youtube.com/embed/" + id
    return VIDEO_EMBED_FORMAT.format(**kw)
Exemple #3
0
    def _generate_app_access_token(self, app_id, app_secret):
        """
        Get an extended OAuth access token.
        :param application_id: An icdsnteger describing the Facebook application's ID.
        :param application_secret_key: A string describing the Facebook application's secret key.
        Returns a tuple with a string describing the extended access token and a datetime instance
        describing when it expires.
        """
        # access tokens
        default_access_token = facepy.get_application_access_token(
            application_id=app_id, application_secret_key=app_secret)
        graph = facepy.GraphAPI(default_access_token)

        response = graph.get(path='oauth/access_token',
                             client_id=app_id,
                             client_secret=app_secret,
                             grant_type='client_credentials')

        return url.get_query_param(response, 'access_token')
    def _generate_app_access_token(self, app_id, app_secret):
        """
        Get an extended OAuth access token.
        :param application_id: An icdsnteger describing the Facebook application's ID.
        :param application_secret_key: A string describing the Facebook application's secret key.
        Returns a tuple with a string describing the extended access token and a datetime instance
        describing when it expires.
        """
        # access tokens
        default_access_token = facepy.get_application_access_token(
            application_id=app_id,
            application_secret_key=app_secret)
        graph = facepy.GraphAPI(default_access_token)

        response = graph.get(
            path='oauth/access_token',
            client_id=app_id,
            client_secret=app_secret,
            grant_type='client_credentials')

        return url.get_query_param(response, 'access_token')