Ejemplo n.º 1
0
def format_profile_v02(name=None,
                       location=None,
                       bio=None,
                       website=None,
                       avatar_url=None,
                       cover_url=None,
                       twitter_username=None,
                       github_username=None,
                       bitcoin_address=None,
                       pgp_fingerprint=None,
                       pgp_url=None):
    profile = recursive_dict()

    profile['v'] = '0.2'

    profile['name']['formatted'] = name
    profile['location']['formatted'] = location
    profile['bio'] = bio
    profile['website'] = website
    profile['avatar'] = {"url": avatar_url}
    profile['cover'] = {"url": cover_url}
    profile['bitcoin'] = {"address": bitcoin_address}
    profile['twitter'] = {"username": twitter_username}
    profile['github'] = {"username": github_username}
    profile['pgp']['fingerprint'] = pgp_fingerprint
    profile['pgp']['url'] = pgp_url

    return scrub_dict(recursive_dict_to_dict(profile))
Ejemplo n.º 2
0
def format_profile_v02(
    name=None,
    location=None,
    bio=None,
    website=None,
    avatar_url=None,
    cover_url=None,
    twitter_username=None,
    github_username=None,
    bitcoin_address=None,
    pgp_fingerprint=None,
    pgp_url=None,
):
    profile = recursive_dict()

    profile["v"] = "0.2"

    profile["name"]["formatted"] = name
    profile["location"]["formatted"] = location
    profile["bio"] = bio
    profile["website"] = website
    profile["avatar"] = {"url": avatar_url}
    profile["cover"] = {"url": cover_url}
    profile["bitcoin"] = {"address": bitcoin_address}
    profile["twitter"] = {"username": twitter_username}
    profile["github"] = {"username": github_username}
    profile["pgp"]["fingerprint"] = pgp_fingerprint
    profile["pgp"]["url"] = pgp_url

    return scrub_dict(recursive_dict_to_dict(profile))
Ejemplo n.º 3
0
def format_profile_v03(name=None,
                       location=None,
                       bio=None,
                       website=None,
                       avatar_url=None,
                       cover_url=None,
                       twitter_username=None,
                       github_username=None,
                       bitcoin_address=None,
                       pgp_fingerprint=None,
                       pgp_url=None):

    profile = recursive_dict()

    profile['v'] = '0.3'
    profile['basics']['name'] = name
    profile['basics']['location'] = location
    profile['basics']['bio'] = bio
    if website:
        profile['websites'] = [{'url': website}]
    profile['photos'] = []
    if avatar_url:
        profile['photos'].append({"type": "avatar", "url": avatar_url})
    if cover_url:
        profile['photos'].append({"type": "cover", "url": cover_url})
    if bitcoin_address:
        profile['payments'] = [{"type": "bitcoin", "address": bitcoin_address}]
    profile['profiles'] = []
    if twitter_username:
        profile['profiles'].append({
            "type": "twitter",
            "username": twitter_username
        })
    if github_username:
        profile['profiles'].append({
            "type": "github",
            "username": github_username
        })
    profile['pgp']['fingerprint'] = pgp_fingerprint
    profile['pgp']['url'] = pgp_url

    return scrub_dict(recursive_dict_to_dict(profile))
Ejemplo n.º 4
0
def format_profile_v03(
    name=None,
    location=None,
    bio=None,
    website=None,
    avatar_url=None,
    cover_url=None,
    twitter_username=None,
    github_username=None,
    bitcoin_address=None,
    pgp_fingerprint=None,
    pgp_url=None,
):

    profile = recursive_dict()

    profile["v"] = "0.3"
    profile["basics"]["name"] = name
    profile["basics"]["location"] = location
    profile["basics"]["bio"] = bio
    if website:
        profile["websites"] = [{"url": website}]
    profile["photos"] = []
    if avatar_url:
        profile["photos"].append({"type": "avatar", "url": avatar_url})
    if cover_url:
        profile["photos"].append({"type": "cover", "url": cover_url})
    if bitcoin_address:
        profile["payments"] = [{"type": "bitcoin", "address": bitcoin_address}]
    profile["profiles"] = []
    if twitter_username:
        profile["profiles"].append({"type": "twitter", "username": twitter_username})
    if github_username:
        profile["profiles"].append({"type": "github", "username": github_username})
    profile["pgp"]["fingerprint"] = pgp_fingerprint
    profile["pgp"]["url"] = pgp_url

    return scrub_dict(recursive_dict_to_dict(profile))