Giter Club home page Giter Club logo

Comments (5)

joshjordan avatar joshjordan commented on June 16, 2024 1

Yeah, the missing piece of the puzzle is that nginx routes to the API only under the /api/ path. Check it out:

https://opensourcecontributo.rs/api/user/nealmcb
https://opensourcecontributo.rs/api/user/nealmcb/events
etc

from opensourcecontributors.

hut8 avatar hut8 commented on June 16, 2024

There already is a simple API, actually. The front end uses it directly. No authentication is necessary. Would you be interested in documenting it?

These are the only endpoints: https://github.com/tenex/opensourcecontributors/blob/master/ghc-app/controller.go#L34

from opensourcecontributors.

nealmcb avatar nealmcb commented on June 16, 2024

Hmm. I tried all those endpoints, and the /user... ones return html, not json. E.g. https://opensourcecontributo.rs/user/nealmcb

The others were just 404 for me. Am I missing something?

from opensourcecontributors.

nealmcb avatar nealmcb commented on June 16, 2024

Indeed - thank you!

I hope to find time to come back to provide proper documentation, but here is an API usage example, in Python, for how to retrieve all events for a user, and hints on sorting them out:

import json
import urllib.request
import codecs

def getevents(userid):
    "Retrieve and return all event pages for given userid"

    reader = codecs.getreader("utf-8")

    events = []
    pagenum = 1
    while True:
        url = "https://opensourcecontributo.rs/api/user/{}/events/{}".format(userid, pagenum)
        page = json.load(reader(urllib.request.urlopen(url)))
        if page["size"] == 0:
            break
        events += page["events"]
        pagenum += 1

    return events

events = getevents("myuserid")  # put userid you want in here

events is now a dict, and the type field indicates whether it is an IssueCommentEvent, PushEvent, IssuesEvent, GollumEvent, CommitCommentEvent, etc.

from opensourcecontributors.

nealmcb avatar nealmcb commented on June 16, 2024

See also:

from opensourcecontributors.

Related Issues (20)

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.