This extension for Visual Studio Code allows you to send requests to your API and receive responses directly within the editor.
- Push
Start Debugging
fromRun
menu - Push
Cmd+Shift+P
- Type in menu
Get API Response
- Send requests to the API at: https://jake-my-copilot-2a9c2ff6d8fb.herokuapp.com/predict
- Display responses from the API within VSCode.
- Clone the repository to your computer.
- Open the extension folder in VSCode.
- Run
npm install
to install the necessary dependencies. - Press
F5
to launch the extension in debug mode.
- Open the command palette (
Ctrl+Shift+P
orCmd+Shift+P
on Mac). - Type "Get API Response" and press Enter.
- View the response from your API in a notification.
- Test the extension with the actual API.
- Register on the Visual Studio Marketplace.
- Publish the extension on the Visual Studio Marketplace.
Your API was built using Flask and Flask-RESTful. Here's its main code:
from flask import Flask, request, jsonify
from flask_restful import Api, Resource
app = Flask(__name__)
api = Api(app)
class Predict(Resource):
def post(self):
# Retrieving data from the request
data = request.get_json(force=True)
code_input = data.get("code", "")
output = f"Received: {code_input}. Here will be the output of your model based on the input data."
return jsonify({"prediction": output})
api.add_resource(Predict, "/predict")
if __name__ == "__main__":
app.run(debug=True, port=5000)