Metadata-Version: 2.4
Name: ipforce
Version: 0.1
Summary: IPForce: Force IPv4/IPv6 in Python HTTP Requests
Home-page: https://github.com/openscilab/ipforce
Download-URL: https://github.com/openscilab/ipforce/tarball/v0.1
Author: IPForce Development Team
Author-email: ipforce@openscilab.com
License: MIT
Project-URL: Source, https://github.com/openscilab/ipforce
Keywords: http ipv4 ipv6 network requests adapter dns socket protocol ip-force
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Topic :: System :: Networking
Classifier: Topic :: Utilities
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: AUTHORS.md
Requires-Dist: requests>=2.20.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: download-url
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary


<div align="center">
<h1>IPForce: Force IPv4/IPv6 in Python HTTP Requests</h1>
<br/>
<a href="https://badge.fury.io/py/ipforce"><img src="https://badge.fury.io/py/ipforce.svg" alt="PyPI version"></a>
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/built%20with-Python3-green.svg" alt="built with Python3"></a>
<a href="https://github.com/openscilab/ipforce"><img alt="GitHub repo size" src="https://img.shields.io/github/repo-size/openscilab/ipforce"></a>
<a href="https://codecov.io/gh/openscilab/ipforce"><img src="https://codecov.io/gh/openscilab/ipforce/graph/badge.svg?token=8EJBSMPZF1"></a>
</div>			
				
## Overview

<p align="justify">					
<b>IPForce</b> is a Python library that provides HTTP adapters for forcing specific IP protocol versions (IPv4 or IPv6) during HTTP requests. It's particularly useful for testing network connectivity, ensuring compatibility with specific network configurations, and controlling which IP protocol version is used for DNS resolution and connections.
</p>

<table>
	<tr>
		<td align="center">PyPI Counter</td>
		<td align="center"><a href="http://pepy.tech/project/ipforce"><img src="http://pepy.tech/badge/ipforce"></a></td>
	</tr>
	<tr>
		<td align="center">Github Stars</td>
		<td align="center"><a href="https://github.com/openscilab/ipforce"><img src="https://img.shields.io/github/stars/openscilab/ipforce.svg?style=social&label=Stars"></a></td>
	</tr>
</table>


<table>
	<tr> 
		<td align="center">Branch</td>
		<td align="center">main</td>	
		<td align="center">dev</td>	
	</tr>
	<tr>
		<td align="center">CI</td>
		<td align="center"><img src="https://github.com/openscilab/ipforce/actions/workflows/test.yml/badge.svg?branch=main"></td>
		<td align="center"><img src="https://github.com/openscilab/ipforce/actions/workflows/test.yml/badge.svg?branch=dev"></td>
	</tr>
</table>

<table>
	<tr> 
		<td align="center">Code Quality</td>
		<td align="center"><a href="https://app.codacy.com/gh/openscilab/ipforce/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade"><img src="https://app.codacy.com/project/badge/Grade/cb2ab6584eb443b8a33da4d4252480bc"/></a></td>
		<td align="center"><a href="https://www.codefactor.io/repository/github/openscilab/ipforce"><img src="https://www.codefactor.io/repository/github/openscilab/ipforce/badge" alt="CodeFactor"></a></td>
	</tr>
</table>


## Installation		

### Source Code
- Download [Version 0.1](https://github.com/openscilab/ipforce/archive/v0.1.zip) or [Latest Source](https://github.com/openscilab/ipforce/archive/dev.zip)
- `pip install .`				

### PyPI
- Check [Python Packaging User Guide](https://packaging.python.org/installing/)     
- `pip install ipforce==0.1`						

## Usage
### Enforce IPv4

Use when you need to ensure connections only use IPv4 addresses, useful for legacy systems that don't support IPv6, networks with IPv4-only infrastructure, or testing IPv4 connectivity.

```python
import requests
from ipforce import IPv4TransportAdapter

# Create a session that will only use IPv4 addresses
session = requests.Session()
session.mount('http://', IPv4TransportAdapter())
session.mount('https://', IPv4TransportAdapter())

# All requests through this session will only resolve to IPv4 addresses
response = session.get('https://ifconfig.co/json')
```

### Enforce IPv6

Use when you need to ensure connections only use IPv6 addresses, useful for modern networks with IPv6 infrastructure, testing IPv6 connectivity, or applications requiring IPv6-specific features.

```python
import requests
from ipforce import IPv6TransportAdapter

# Create a session that will only use IPv6 addresses
session = requests.Session()
session.mount('http://', IPv6TransportAdapter())
session.mount('https://', IPv6TransportAdapter())

# All requests through this session will only resolve to IPv6 addresses
response = session.get('https://ifconfig.co/json')
```

> [!WARNING]
> Current adapters are NOT thread-safe! They modify the global `socket.getaddrinfo` function, which can cause issues in multi-threaded applications.

## Issues & Bug Reports			

Just fill an issue and describe it. We'll check it ASAP!

- Please complete the issue template


## Show Your Support
								
<h3>Star This Repo</h3>					

Give a ⭐️ if this project helped you!

<h3>Donate to Our Project</h3>	

If you do like our project and we hope that you do, can you please support us? Our project is not and is never going to be working for profit. We need the money just so we can continue doing what we do ;-)			

<a href="https://openscilab.com/#donation" target="_blank"><img src="https://github.com/openscilab/ipforce/raw/main/otherfiles/donation.png" height="90px" width="270px" alt="IPForce Donation"></a>

# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.1] - 2026-02-16
### Added
- `IPv6TransportAdapter` class
- `IPv4TransportAdapter` class
- Test system

[Unreleased]: https://github.com/openscilab/ipforce/compare/v0.1...dev
[0.1]: https://github.com/openscilab/ipforce/compare/7128b04...v0.1
