GithubHelp home page GithubHelp logo

cst_rest_example's Introduction

CST Rest Example

This repo contains an example of the use of CST REST API, integrating Python code on CST's Java implementation.

The ANA (acronymous for API Newbie Agent) will read a list of tasks in a JSON-formatted file (tasks.json) and will print either the English to German translation of a list of sentences or the 1000 first characters of a Wikipedia page's summary about a given subject.

How it works

First, you'll need to activate the virtual environment in this repo by running the following command, from the project's root folder:

./venv/bin/activate

Then the Flask API server must be run with IP:port arguments:

python3 soteropolitan.py 127.0.0.1:5000

Notice that we used localhost and port 5000, but this may be customized by changing both the Python script`s arguments and the Java agent's internal (hardcoded) parameter.

After that, running the Java program will execute the proposed example.

What is going on?

Internally, the Sensory Codelet read the tasks.json file and passes the tasks one by one to the Reactivity Codelet as an entry in a HashMap. The Reactivity will then pass this info to either GermanTranslation on Wikipedia Codelet, according to the task. Those Codelets will make a GET or POST request - Wikipedia and GermanTranslator, respectively - and print the response given by the server in the terminal. The figure below illustrates the Agent's topology.

ANA (API Newbie Agent)

cst_rest_example's People

Contributors

wandemberg-eldorado 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.