Skip to content

amcooper181/Joke-app-microservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Joke Generating App Microservice

This microservice generates a random joke from sv443's API using the JokeAPI Python Wrapper.

Pre-requirements

The JokeAPI Python Wrapper must be installed.

The Requests library must be installed.

Startup

In order to use the microservice, it must be launched first. Launch a terminal or command prompt window at the directory containing the joke_requester_v2.py file, and run:

$ python3.11 joke_requester_v2.py

This will start the service. The following should be displayed in the terminal, confirming the service is running:

Server started at http://localhost:8080

Requesting Data

The Requests library is used to interact with this service. Paste the following at the top of your Python file, or into your Python console:

import requests

Now, you can request a new joke using a GET request as follows:

response = requests.get('http://localhost:8080')

Receiving/Accessing the joke

Accessing the joke can be done easily:

new_joke = response.text

UML Sequence Diagram

Joke Microservice UML

Blacklist

This microservice blacklists the following categories: 'nsfw', 'racist', 'sexist', 'religious', 'political'. This can be changed by modifying the request function, currently on line 26.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages