Skip to content

( Deprecated ) An asynchronous API made with FastAPI to grab upcoming contests' information from different platforms.

License

Notifications You must be signed in to change notification settings

Nusab19/ContestsAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠ Deprecated ⚠

This project is no longer maintained

A better approach has been made Contest Hive. It is open-source and has better API support.

Use Contest Hive API for production purposes.

Old Readme

A totally asynchronous API made with FastAPI to grab upcoming contests' information from different platforms.

Warning

If you want to use this API in production, it is highly recommended to fork this repository.
Beacause I am adding new platforms regularly and code is improving continuously.
There will come new versions of this API soon. (After May 23, 2023)
So, fork this repo so your project doesn't get hampered by new changes.

7 Available Platforms

  1. Atcoder
  2. CodeChef
  3. Codeforces
  4. HackerEarth
  5. HackerRank
  6. LeetCode
  7. Toph


Endpoints

/docs - Documentation.

Note: All responses are in pretty JSON format.

/platforms - All available Platforms

As this API needs to make http requests fetches data, there will be some delay. So, I made a solution for that.

/cached endpoint will give you instant response.

Every 7 minutes, it fetches data from all the platforms and stores it locally.

It is highly recommended to use /cached endpoint. Use the direct endpoints if you feel the necessity.

The structure is like:

example.api.com/cached/<method>

Example:

https://contestsapi.onrender.com/cached/2 2 == codechef

See /platforms for numeric names of each platform.

Sample Response:

{
    "ok": true,
    "data": [
        {
            "name": "Starters 78",
            "url": "https://www.codechef.com/START78",
            "startTime": "22-02-2023 14:30:00 UTC",
            "duration": "3 hours",
            "durationSeconds": 10800
        },
        {
            "name": "Starters 79",
            "url": "https://www.codechef.com/START79",
            "startTime": "01-03-2023 14:30:00 UTC",
            "duration": "3 hours",
            "durationSeconds": 10800
        }
    ]
}

Just put the method's name after /cached/.

Direct Endpoints (methods):

/all - Contests from all Platforms

Note: The response will be very slow as this method makes http requests to all the platforms. Use /cached/all instead.

/atcoder or /1 - Contests of Atcoder

/codeforces or /2 - Contests of Codeforces

/codechef or /3 - Contests of CodeChef

/hackerearth or /4 - Contests of HackerEarth

/toph or /5 - Contests of Toph

/status - A brief status of the API.


Live API

contestsapi.onrender.com

Installation

git clone https://github.com/Nusab19/ContestsAPI
cd ContestsAPI
pip install -r requirements.txt
python main.py

You may also use uvicorn main:app --reload --port 5000 --host 0.0.0.0 instead of python main.py

Visit localhost:5000 after running locally.

Make sure to give a star if you like it! :D

Made with ❤ and effort by @Nusab19

About

( Deprecated ) An asynchronous API made with FastAPI to grab upcoming contests' information from different platforms.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages