gridhead / fedora-easyfix

A collection of self-contained and well-documented issues for newcomers to start contributing with
MIT License
9 stars 4 forks source link

Added REST API endpoints for forge, repo and issue information #25

Closed gridhead closed 3 years ago

gridhead commented 3 years ago

Can be used for asynchronously fetching and updating the DOM.

How do you test?

  1. Follow the setup instructions on the README.md to generate a JSON index and start the server.
  2. Run the following commands and notice their outputs.
    from urllib3 import PoolManager
    from json import loads
    httpobjc = PoolManager()
    respobjc = httpobjc.request("GET", "http://localhost:9696/endpoint/")
    loads(respobjc.data.decode())
    from urllib3 import PoolManager
    from json import loads
    httpobjc = PoolManager()
    respobjc = httpobjc.request("GET", "http://localhost:9696/endpoint/", fields={"command":"PREL"})
    loads(respobjc.data.decode())
    from urllib3 import PoolManager
    from json import loads
    httpobjc = PoolManager()
    respobjc = httpobjc.request("GET", "http://localhost:9696/endpoint/", fields={"command": "REPO", "forge": "gitlab", "repository": "t0xic0der/fragment"})
    loads(respobjc.data.decode())
    from urllib3 import PoolManager
    from json import loads
    httpobjc = PoolManager()
    respobjc = httpobjc.request("GET", "http://localhost:9696/endpoint/", fields={"command": "TICK", "forge": "gitlab", "repository": "t0xic0der/fragment", "number": 11})
    loads(respobjc.data.decode())

See if it works.

gridhead commented 3 years ago

@nphilipp, see if some more things need to be changed.