(long_url, short_code=None, expire_after=None, description=None,
            secret_key=None, owner=None, request=None)
return LinkSchema().dump(url_manager.link).data
Helper class that has been deligated the task of inserting the
    passed url in DB, base 62 encoding from db id and return the short
    url value.

    :param long_url:
    :param short_code:
    :param description:
    :param expire_after:
    :param secret_key:
    :param owner:
    :return:
Helper class that has been deligated the task of inserting the
    passed url in DB, base 62 encoding from db id and return the short
    url value.
Helper class that has been deligated the task of inserting the passed url in DB base 62 encoding from db id and return the short url value .
def shorten(long_url, short_code=None, expire_after=None, description=None,
            secret_key=None, owner=None, request=None):
    """Helper class that has been deligated the task of inserting the
    passed url in DB, base 62 encoding from db id and return the short
    url value.

    :param long_url:
    :param short_code:
    :param description:
    :param expire_after:
    :param secret_key:
    :param owner:
    :return:
    """
    url_manager = LinkManager()
    query_dict = dict(long_url=long_url, is_custom=False, is_protected=False)
    insert_dict = query_dict
    if short_code:
        query_dict.update(dict(short_code=short_code, is_custom=True))
        insert_dict = query_dict
    if secret_key:
        query_dict.update(secret_key=str(secret_key), is_protected=True)
        insert_dict = query_dict
    if expire_after:
        insert_dict['expire_after'] = expire_after
    urlobj = url_manager.find(**query_dict)
    if urlobj is None:
        url_manager.add(**insert_dict)
    if request:
        return url_manager.link
    return LinkSchema().dump(url_manager.link).data
def shorten ( long_url , short_code = None , expire_after = None , description = None , secret_key = None , owner = None , request = None ) : url_manager = LinkManager ( ) query_dict = dict ( long_url = long_url , is_custom = False , is_protected = False ) insert_dict = query_dict if short_code : query_dict . update ( dict ( short_code = short_code , is_custom = True ) ) insert_dict = query_dict if secret_key : query_dict . update ( secret_key = str ( secret_key ) , is_protected = True ) insert_dict = query_dict if expire_after : insert_dict [ 'expire_after' ] = expire_after urlobj = url_manager . find ( * * query_dict ) if urlobj is None : url_manager . add ( * * insert_dict ) if request : return url_manager . link return LinkSchema ( ) . dump ( url_manager . link ) . data