CodeLegendX's blog

By CodeLegendX, 13 days ago, In English

cf-helper is a Python library designed to simplify interaction with the Codeforces API. It abstracts the complexity of API calls, making it easy to fetch user data, contest information, problems, standings, and more.

Features

  • Fetch user details like rating and rank:

  print_user_info(handle="YourHandle")
  • Get the latest submissions:

  print_user_status(handle="YourHandle", noOfEntries=2)
  • Find problems by tag or rating:

  print_problems(noOfEntries=3, tags="dp", rating=1900)
  • Find problems you haven’t solved yet:

  print_unattempted_problems(handle="YourHandle", tags="dp", rating=1600, noOfEntries=3, chooseRandom=True)
  • Discover upcoming contests:

  print_upcoming_contest()
  • Fetch virtual contests based on your preferences:

  print_virtual_contests(handle="YourHandle", contest_type="Div. 2", noOfContest=2, chooseRandom=True)
  • Analyze contest rating changes:

  print_rating_changes(contest_id=566, noOfEntries=2)
  • Get a user’s rating change for a specific contest:

  print_user_rating_change(contest_id=2040, handle="YourHandle")
  • Fetch contest standings:

  print_contest_standings(contestId=2040, from_index=1, count=5, showUnofficial=True)
  • Find your rank in a contest:

  print_user_standing(contestId=2006, handles="handle1;handle2", showUnofficial=True)
  • Get direct links to accepted submissions:

  print_submission_link(handle="YourHandle", contestId=2040, index="G")

Installation

  • Install using pip:

  pip install cf-helper
  • API Key Setup (Optional)

    To access private API endpoints (e.g., friends list), generate an API key and secret via Codeforces API Settings and store them in a .env file:
    key="your_api_key"
    secret="your_api_secret"

Conclusion

cf-helper streamlines Codeforces data retrieval for competitive programmers. Explore its features and integrate it into your workflow. For suggestions or contributions, visit cf-helper on GitHub

Full text and comments »

  • Vote: I like it
  • +10
  • Vote: I do not like it