Skip to main content

Stands for Python random api wrapper version 2.

Project description

prsaw2

Simple python API wrapper for the Random Stuff API.

  • Easy to use

  • Wraps the entire API

  • Supports both async and sync

  • Supports v2, v3 and v4 version of API

  • PyPi Package

  • Documentation

Installation

Installation can be done easily using the python package manager pip

pip install prsaw2

Quickstart

Firstly make sure to get the API key from here

Here are few examples to get you started.

Getting AI response

import prsaw2

client = prsaw2.Client(key='api-key-here')

response = client.get_ai_response("Hi there")
client.close()  # Not necessary
print(response)

Getting random joke

import prsaw2

client = prsaw2.Client(key='api-key-here')

response = client.get_joke(type="any")
client.close()  # Not necessary
print(response.joke)

Getting random image

import prsaw2

client = prsaw2.Client(key='api-key-here')

response = client.get_image(type="any")
client.close()
print(response)

Async Support

The library also supports async usage.

import prsaw2
import asyncio

client = prsaw2.AsyncClient(key="api-key-here")

async def coro():
  response = await client.get_ai_response("Hello world")
  await client.close()  
  print(response)

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prsaw2-0.42.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

prsaw2-0.42-py3-none-any.whl (5.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page