(link)
return {**link_info, **click_info}
Pass link and clickmeta model objects ans returns a formatted dict.

    :param link:
    :param clickmeta:
    :return:
Pass link and clickmeta model objects ans returns a formatted dict.
Pass link and clickmeta model objects ans returns a formatted dict .
def formatted_link_stats(link):
    """Pass link and clickmeta model objects ans returns a formatted dict.

    :param link:
    :param clickmeta:
    :return:
    """
    manager = ClickMetaManager()
    click_meta = manager.click_stats(link.id)
    link_info = dict(
            long_url=link.long_url,
            short_code=link.short_code,
            created_at=link.created_at
    )
    click_info = {
        'total_hits': click_meta.get('hits', 0),
        'country_stats': click_meta.get('country_hits', {}),
        'referrer': click_meta.get('referrer_hits', {}),
        'time_series_base': click_meta.get('time_base'),
        'time_stats': click_meta.get('timestamp_hits', {}),
    }

    # Hide original/long_url in case of protected links
    if link.is_protected is True:
        link_info['long_url'] = ''
    return {**link_info, **click_info}
def formatted_link_stats ( link ) : manager = ClickMetaManager ( ) click_meta = manager . click_stats ( link . id ) link_info = dict ( long_url = link . long_url , short_code = link . short_code , created_at = link . created_at ) click_info = { 'total_hits' : click_meta . get ( 'hits' , 0 ) , 'country_stats' : click_meta . get ( 'country_hits' , { } ) , 'referrer' : click_meta . get ( 'referrer_hits' , { } ) , 'time_series_base' : click_meta . get ( 'time_base' ) , 'time_stats' : click_meta . get ( 'timestamp_hits' , { } ) , } # Hide original/long_url in case of protected links if link . is_protected is True : link_info [ 'long_url' ] = '' return { * * link_info , * * click_info }