Created
February 18, 2024 05:49
-
-
Save useraid/154844af6b86c42b224b270f8c535262 to your computer and use it in GitHub Desktop.
Pulls Leetcode stats and save it to file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
username = "useraid" | |
url = f"https://leetcode-api-faisalshohag.vercel.app/{username}" | |
response = requests.get(url) | |
data = response.json() | |
with open("lc", "w") as file: | |
file.write(f"Total Solved: {data['totalSolved']}\n") | |
file.write(f"Ranking: {data['ranking']}\n") | |
file.write(f"Contribution Point: {data['contributionPoint']}\n") | |
file.write(f"Reputation: {data['reputation']}\n") | |
file.write("\nTotal Submissions:\n") | |
for submission in data['totalSubmissions']: | |
file.write(f"Difficulty: {submission['difficulty']}, Count: {submission['count']}, Submissions: {submission['submissions']}\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment