Skip to main content

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.

Metadata

Release files for apinum 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apinum 0.1.8
File Size Uploaded
apinum-0.1.8.tar.gz 37.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for apinum 0.1.8
File Interpreter ABI Platform
apinum-0.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 73.0 kB

Release files / apinum-0.1.8.tar.gz

Download URL apinum-0.1.8.tar.gz
Size 37.4 kB
Tags Source
SHA-256 checksum
How to use checksums
6e1a609335472a2eb10542adcd3c4022a3d60b17723dfc88a964e87c63bcdb8b
BLAKE2b-256 checksum
How to use checksums
be6aa5a1ef4c808865864d7fe42d4a82c1b3caf3d685719e92fb7514aa84ec9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Release files / apinum-0.1.8-py3-none-any.whl

Download URL apinum-0.1.8-py3-none-any.whl
Size 35.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8c31e181f6b8467dddbab90065c5cfcf7382ba9de20fe2439995ba808cef32a
BLAKE2b-256 checksum
How to use checksums
3bf6ecef30f3e183d175e5b671f12a02f1e9de73a4d4beaf607ad763edb350ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.19

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page