Coder Social home page Coder Social logo

nusab19 / contestsapi Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 0.0 140 KB

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

Home Page: https://contestsapi.onrender.com

License: MIT License

Python 100.00%
asynchronous atcoder codeforces fastapi hackerearth open-source python codechef leetcode toph

contestsapi's Introduction

⚠ 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

contestsapi's People

Contributors

nusab19 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.