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 both v2 and v3 versions 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.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

prsaw2-0.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file prsaw2-0.2.tar.gz.

File metadata

  • Download URL: prsaw2-0.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for prsaw2-0.2.tar.gz
Algorithm Hash digest
SHA256 6a1af4ec570f783b3a800877e5c3072c9cd259e4e778d70070d0cef6431da73f
MD5 49763f5a3a9f36a754af725fa420cd17
BLAKE2b-256 d9fa3c25d13c99b046fa7f4e299120c156cf0706cb2e1abf6b02c9af9931f586

See more details on using hashes here.

File details

Details for the file prsaw2-0.2-py3-none-any.whl.

File metadata

  • Download URL: prsaw2-0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.6

File hashes

Hashes for prsaw2-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c6bc50d73a046026f85f35f118b181b0d391fba470e5fb64b15b62e9d20774bd
MD5 739ed000694ace5aa42c716567bcdfe6
BLAKE2b-256 2fe591e2d37778ee0b6dcb44ef574522b5b3f0a102d05ace2e65671a12efbabb

See more details on using hashes here.

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