Skip to content
Sayad Uddin Tahsin edited this page Apr 8, 2023 · 2 revisions

The Facts category provides interesting and fun facts about various animals such as birds, cats, dogs, pandas, koalas, and foxes. Users can choose a specific animal and get a random fact about them.

class Bird

Returns a random Fact about Bird

Attributes

  • fact (str): A fact about the bird.
  • raw (dict): The raw JSON response from the API.

Exceptions

  • APITimeout: Raised when the API takes too long to respond.
  • APIError: Raised when the API returns an error.

Example

from sra import facts

# Create a new instance of the Bird class
bird = facts.Bird()

# Get the fact about the bird
fact = bird.fact

class Cat

Returns a random Fact about Cat

Attributes

  • fact (str): A fact about the cat.
  • raw (dict): The raw JSON response from the API.

Exceptions

  • APITimeout: Raised when the API takes too long to respond.
  • APIError: Raised when the API returns an error.

Example

from sra import facts

# Create a new instance of the Cat class
cat = facts.Cat()

# Get the fact about the cat
fact = cat.fact

class Dog

Returns a random Fact about Dog

Attributes

  • fact (str): A fact about the dog.
  • raw (dict): The raw JSON response from the API.

Exceptions

  • APITimeout: Raised when the API takes too long to respond.
  • APIError: Raised when the API returns an error.

Example

from sra import facts

# Create a new instance of the Dog class
dog = facts.Dog()

# Get the fact about the bird
fact = dog.fact

class Fox

Returns a random Fact about Fox

Attributes

  • fact (str): A fact about the fox.
  • raw (dict): The raw JSON response from the API.

Exceptions

  • APITimeout: Raised when the API takes too long to respond.
  • APIError: Raised when the API returns an error.

Example

from sra import facts

# Create a new instance of the Fox class
fox = facts.Fox()

# Get the fact about the bird
fact = fox.fact

class Koala

Returns a random Fact about Koala

Attributes

  • fact (str): A fact about the koala.
  • raw (dict): The raw JSON response from the API.

Exceptions

  • APITimeout: Raised when the API takes too long to respond.
  • APIError: Raised when the API returns an error.

Example

from sra import facts

# Create a new instance of the Koala class
koala = facts.Koala()

# Get the fact about the bird
fact = koala.fact

class Panda

Returns a random Fact about Panda

Attributes

  • fact (str): A fact about the panda.
  • raw (dict): The raw JSON response from the API.

Exceptions

  • APITimeout: Raised when the API takes too long to respond.
  • APIError: Raised when the API returns an error.

Example

from sra import facts

# Create a new instance of the Panda class
panda = facts.Panda()

# Get the fact about the panda
fact = panda.fact
Clone this wiki locally