# randomstuff.py

An easy-to-use and feature rich API wrapper for the [Random Stuff API](http://docs.pgamerx.com/)

## 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](https://pypi.org/project/randomstuff.py) and can be installed using [pip](https://pypi.org/project/pip/). Make sure to install [Python (3.6 or later. Recommended is 3.8)](https://www.python.org/downloads/release/python-380/)

```
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

```python
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

```python
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.

```python
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.

```python
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`](https://nerdguyahmad.gitbook.io/randomstuff/data-classes/joke) object so you can see it's doc for more info.

## Contributions

This library is powered by the amazing community on [GitHub](https://github.com/nerdguyahmad/randomstuff.py). If you want to contribute to this library, Go to GitHub and land your contribution! :)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nerdguyahmad.gitbook.io/randomstuff/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
