Skip to content

Retrieve public data from Salesforce Trailhead user profiles

License

Notifications You must be signed in to change notification settings

octatau/trailhead-scraper

Repository files navigation

Trailhead Scraper

license Trailhead Scraper Tests status on GitHub Actions

A simple package that enables retrieval of public data from Salesforce Trailhead user profiles.

Installation

trailhead-scraper can be installed via pip:

$ pip install trailhead-scraper

Quickstart

You can now retrieve information about a Trailhead user based on a username:

from trailhead_scraper import fetch_profile_data, fetch_rank_data, fetch_awards

username = "trailhead-username"

# get profile information
profile = fetch_profile_data(username)

# get rank information
rank_data = fetch_rank_data(username)

# get list of awards (badges)
awards = fetch_awards(username)

Use the profile data to access basic information about the user:

print(profile["profilePhotoUrl"])
print(profile["profileUser"]["FirstName"])
print(profile["profileUser"]["LastName"])
print(profile["profileUser"]["CompanyName"])
print(profile["profileUser"]["Title"])

Use the rank data to get the user's rank and related information:

print(rank_data["RankLabel"])
print(rank_data["RankImageUrl"])
print(rank_data["EarnedPointTotal"])
print(rank_data["EarnedBadgeTotal"])
print(rank_data["CompletedTrailTotal"])
print(rank_data["PointTotalForNextRank"])
print(rank_data["BadgeTotalForNextRank"])

The list of awards contains details about each award (badge/recognition) earned by the user:

for award in awards:
   print(award["AwardType"], award["Award"]["Label"])

About

Retrieve public data from Salesforce Trailhead user profiles

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages