Skip to main content

Random.org Api Wrapped in Python

Project description

This Python module provides a wrapper for the Random.org API to generate various types of random data such as integers, sequences, decimal fractions, Gaussian numbers, strings, UUIDs, and random blobs.

Features

  • Generate random integers, integer sequences, decimal fractions, and Gaussian-distributed numbers.

  • Generate random strings, UUIDs, and blobs.

  • Retrieve API usage statistics, including remaining bits and requests.

Installation

Usage

  1. Import the BasicApi class and initialize it with your Random.org API key:

    from basic_api import BasicApi
    
    api = BasicApi(api_key="your_api_key")
  2. Call the available methods to generate random data. For example, to generate random integers:

    random_integers = api.generate_integers(num=5, minimum=1, maximum=100)
    print(random_integers)
  3. You can also check your API usage:

    usage_stats = api.get_usage()
    print(usage_stats)

Running Tests

The project includes tests written using pytest. To run the tests:

  1. Install pytest:

    pip install pytest
  2. Run the tests:

    pytest

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

py_random_dot_org-1.0.2.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

py_random_dot_org-1.0.2-py3-none-any.whl (6.3 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