Skip to main content

randomstuff.py

An easy to use, feature rich, highly customisable and async pythonic API wrapper for the Random Stuff API.


Features

  • Easy-to-use & Organized
  • Designed to be as optimized as possible
  • Implements the entire API including all supported versions
  • Supports both async and sync
  • Supports all type of API plans
  • All classes are well documented
  • Actively maintained, Remains up-to-date with all updates.

Installation

Installation can be done easily using the python package manager pip

pip install randomstuff.py

Quickstart

Firstly make sure to get the API key from here

Here are few examples to get you started.

Getting AI response

import randomstuff

with randomstuff.Client(api_key='api-key-here') as client:
  response = client.get_ai_response("Hi there")
  print(response.message)

Getting random joke

import randomstuff

with randomstuff.Client(api_key='api-key-here') as client:
  joke = client.get_joke(type="any")
  print(response.joke)

Getting random image

import randomstuff

with randomstuff.Client(api_key='api-key-here') as client:
  image = client.get_image(type="any")
  print(response)

Getting weather

import randomstuff

with randomstuff.Client(api_key='api-key-here') as client:
  weather = client.get_weather("new york")
  # print(weather) # Uncomment to see full object.
  print("Current weather in {} is {} degree centigrade".format(weather.location.name, weather.current.temperature))

Async Support

This library also supports async usage.

import randomstuff
import asyncio

async def coro():
  async with randomstuff.AsyncClient(api_key="api-key-here") as client:
    response = await client.get_ai_response("Hello world")
    print(response.message)

loop = asyncio.get_event_loop()
loop.run_until_complete(coro())

Contribution

This library is powered by community contributions. Feel free to open a pull request to contribute.

Metadata

Release files for randomstuff.py 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for randomstuff.py 2.0.0
File Interpreter ABI Platform
randomstuff.py-2.0.0-py3-none-any.whl Python 3 none any Details

Release files / randomstuff.py-2.0.0-py3-none-any.whl

Download URL randomstuff.py-2.0.0-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e2f64322072eaf6f9afd2efeef53aa726b14ae6e750b1d897f96080658e3298
BLAKE2b-256 checksum
How to use checksums
56f803131ea7e984bd8a735b0e3bf175346dde635337eca86c5d8b55db4086b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.3

Release history Release notifications | RSS feed

This release

2.0.0 This release

1 release file

1.6.3

1 release file

1.6.1

1 release file

1.6.0

1 release file

1.5.2

1 release file

1.5.1

1 release file

1.5.0

1 release file

1.4.6

1 release file

1.4.5

1 release file

1.4.3

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.3

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.0.2

1 release file

1.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page