Skip to main content

No project description provided

Project description

APINum Library

Overview

APINum is a Python library designed for extracting well numbers, such as API (American Petroleum Institute) numbers, now known as US Well Numbers, from strings. It validates well numbers against predefined codes and supports different digit formats for API numbers/US Well Numbers.

Installation

Install APINum directly using pip:

pip install apinum

Features

  • Extract well numbers from strings.
  • Validate well numbers against a list of predefined codes.
  • Support for 10, 12, and 14-digit API number formats.
  • Provides formatted and unformatted well number outputs.

Usage

To use APINum, import and initialize the APINumber class with a string containing a well number. The class parses and extracts the API number from the string.

from apinum import APINumber

# Example string containing an API number
input_string = "Your string containing API number"
api_number = APINumber(input_string)

# Access extracted API number and other details
print(api_number.extracted_number)
print(api_number.formatted_14_digit)

Available Attributes

APINumber provides the following attributes to access the extracted number details:

  • extracted_number: The raw extracted API number.
  • formatted_14_digit: Formatted 14-digit API number.
  • formatted_12_digit: Formatted 12-digit API number.
  • formatted_10_digit: Formatted 10-digit API number.
  • unformatted_14_digit: Unformatted 14-digit API number.
  • unformatted_12_digit: Unformatted 12-digit API number.
  • unformatted_10_digit: Unformatted 10-digit API number.

Error Handling

APINumber raises exceptions for invalid inputs or if no API number is found:

  • TypeError: Input is not a valid string.
  • ValueError: No API number found in the input string.

Configuration

The library uses JSON files for valid API codes and mappings. Ensure these files are correctly set up in your working directory.

Contribution

Contributions are welcome. Follow standard practices for contributing to Python packages, such as forking the repository, making changes, and submitting a pull request.

License

Include the license here to inform users of their rights when using and modifying the APINum library.

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

apinum-0.1.8.tar.gz (37.4 kB view details)

Uploaded Source

Built Distribution

apinum-0.1.8-py3-none-any.whl (35.6 kB view details)

Uploaded Python 3

File details

Details for the file apinum-0.1.8.tar.gz.

File metadata

  • Download URL: apinum-0.1.8.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for apinum-0.1.8.tar.gz
Algorithm Hash digest
SHA256 6e1a609335472a2eb10542adcd3c4022a3d60b17723dfc88a964e87c63bcdb8b
MD5 25bc8fb4e7f757aa96f08fc1347c1cfc
BLAKE2b-256 be6aa5a1ef4c808865864d7fe42d4a82c1b3caf3d685719e92fb7514aa84ec9c

See more details on using hashes here.

File details

Details for the file apinum-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: apinum-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 35.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for apinum-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 a8c31e181f6b8467dddbab90065c5cfcf7382ba9de20fe2439995ba808cef32a
MD5 8d9ea705f96e43e8958bddf5ed8eef2b
BLAKE2b-256 3bf6ecef30f3e183d175e5b671f12a02f1e9de73a4d4beaf607ad763edb350ff

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