Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make fetching of resources dynamic with GitHub API #17

Open
1 task done
Bhupesh-V opened this issue Feb 6, 2023 · 11 comments
Open
1 task done

Make fetching of resources dynamic with GitHub API #17

Bhupesh-V opened this issue Feb 6, 2023 · 11 comments
Assignees
Labels
backend enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Bhupesh-V
Copy link
Member

Feature details?

Currently, we manually have to update this map to introduce any new categories

CATEGORIES = {
    "Python": "python",
    "JavaScript": "javascript",
    "C++": "cpp",
    "C":"c",
    "CSS":"css",
    "Data Structures & Algorithms": "dsa",
    "Machine Learning": "machine-learning",
    "Deep Learning": "deep-learning",
    "Computer Science": "computer-science",
    "Computer Graphics": "computer-graphics",
    "Git": "git",
    "Android": "android",
    "Surprise Me!": "miscellaneous",
}

This can be automated by calling the GitHub API to find directories that contain the index.json file.

# get repo file paths
curl -H "Authorization: token YOUR_ACCESS_TOKEN" https://api.github.com/repos/OWNER/REPO/contents

# get paths inside a directory
curl -H "Authorization: token YOUR_ACCESS_TOKEN" https://api.github.com/repos/OWNER/REPO/contents/path/to/directory

The work will involve automatically calling the correct endpoints to dynamically generate resource categories.

Bonus points if you can do this asynchronoisly to reduce the latency!

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Bhupesh-V Bhupesh-V added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Feb 6, 2023
@Bhupesh-V Bhupesh-V pinned this issue Feb 6, 2023
@pratik9333
Copy link

can I work on this? @Bhupesh-V

@Bhupesh-V
Copy link
Member Author

can I work on this? @Bhupesh-V

Sure, go ahead, this is going to be a big change, so if you need help, feel free to reach out here or maybe create draft PRs to ask any questions

@AmanSal1
Copy link

So for example if we click on Python then all the resources are shown up .
I wanted to ask are these resources put up by you or are the fetched by the api ?

@Animesh-Ghosh
Copy link

@AmanSal1 the resources are in developersIndia/resources. So the idea here is fetching the resources from that repository using the GitHub APIs @Bhupesh-V mentioned on the issue description.

@jatinb92
Copy link

Hi @Bhupesh-V , I would like to contribute as well.
@pratik9333, please let me know if we can work on this together or you need any other help.

@AmanSal1
Copy link

@Animesh-Ghosh oh got it ! now basically you want the resource to get fetched automatically from the git hub repository of resources when ever there is an updated of new resources in that repository .

@pratik9333
Copy link

Hi @Bhupesh-V , I would like to contribute as well. @pratik9333, please let me know if we can work on this together or you need any other help.

sure, I haven't started yet but about to start.

@AmanSal1
Copy link

@Bhupesh-V i have a doubt do you want your API path to get automatically updated whenever there is a new change in the resources repository( resourcer.py ) or you just want the categories to get updated automatically in the (main.py) ?

@Bhupesh-V
Copy link
Member Author

@Bhupesh-V i have a doubt do you want your API path to get automatically updated whenever there is a new change in the resources repository( resourcer.py ) or you just want the categories to get updated automatically in the (main.py) ?

The categories should dynamically update. This involves finding file paths that end with index.json find their necessary category and build the necessary HTML as in main.py

@AmanSal1
Copy link

I have applied a different logic to add the content automatically to the website but then you have to update the API PATH in the resourcer.py

here are some of the screenshots i tried adding manually to the API PATH to check the result 👍

1

Automatically updated the CATEGORIES

3

RUST UPDATED IN THE SITE

4

@Bhupesh-V
Copy link
Member Author

@AmanSal1 could you possibly open a draft PR with whatever implementation you have, it will be better since we will be on the same page, and any feedback/discussions can be done on that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants