randomstuff.py

An easy-to-use and feature rich API wrapper for the Random Stuff API

Features

  • Easy to use & organised: Parameters and method names are same as suggested by API. Uses object oriented design to ease the user.

  • Well optimised: The wrapper is designed to be as optimised as possible.

  • Customisation: You can customise the wrapper as you want using multiple versions support.

  • Up-to-date: Wrapper is well maintained and is kept updated with the API.

  • Entire API wrapped: This wraps the entire API including the version 3 as well as the latest version 4 of the API.

Installation

This library is available on PyPi and can be installed using pip. Make sure to install Python (3.6 or later. Recommended is 3.8)

pip install randomstuff.py --upgrade

Getting started

Though this is not a complex wrapper, it is recommended to have knowledge of Python.

Other then that, to whet your appetite, Here are some quick examples to get you started.

Getting Random AI response

import randomstuff

client = randomstuff.Client(api_key="api-key-here")

response = client.get_ai_response("Hi there!")
print(response.message)

Using the above code, you got an AI response to the message which was "Hi there!".

Getting Weather

import randomstuff

client = randomstuff.Client(api_key="api-key-here")
weather = client.get_weather('new york')

print(weather)

Getting Images (and Jokes)

This wrapper also supports the image and joke endpoint.

import randomstuff

client = randomstuff.Client(api_key="api-key-here")

image = client.get_image()
print(image) # Prints the image URL.

Now, for the joke endpoint.

import randomstuff

client = randomstuff.Client(api_key="api-key-here")

joke= client.get_joke()
print(joke.joke) # Prints the joke.

The joke can be a dictionary or a string depending on its type. joke is randomstuff.Joke object so you can see it's doc for more info.

Contributions

This library is powered by the amazing community on GitHub. If you want to contribute to this library, Go to GitHub and land your contribution! :)

Last updated