Compare commits

...

19 Commits
1.0.2 ... main

Author SHA1 Message Date
Daniel Carrillo e5685511ba
[chore] Bump actions version 2024-03-22 16:56:37 +01:00
Daniel Carrillo d1d01b242c
Drop support for python 3.7 2024-03-22 16:49:17 +01:00
Daniel Carrillo e2f0f4f63c
chore: Bump python version to 3.11 2023-06-24 11:57:53 +02:00
Daniel Carrillo b657c4a4d3
Fix linting warning 2022-09-30 21:07:44 +02:00
Daniel Carrillo 87618a960d
Update README.md to enforce the use of pipx for installing 2022-03-26 20:33:27 +01:00
Daniel Carrillo b1f48d5534
Fix badges links at README.md 2021-12-26 12:05:22 +01:00
Daniel Carrillo ca98c678b2
Merge pull request #8 from dcarrillo/add-3.10-tests
Add python 3.10 to the tests matrix
2021-12-24 12:54:31 +01:00
Daniel Carrillo 5b58df2b3a
Fix workflow yaml 2021-12-24 12:46:57 +01:00
Daniel Carrillo ad80450442
Add python 3.10 to the tests matrix 2021-12-24 12:45:01 +01:00
Daniel Carrillo 61970f6679
Merge pull request #7 from dcarrillo/fix-mypy
Install missing stubs for mypy
2021-07-01 19:55:08 +02:00
Daniel Carrillo 613727ef5a
Install missing stubs for mypy 2021-07-01 19:51:08 +02:00
Daniel Carrillo a3517a25ab
Merge pull request #6 from dcarrillo/1.0.4
Return an empty array when there is no data for json output
2021-02-19 17:51:56 +01:00
Daniel Carrillo 204ec8f9ff
Return an empty array when there is no data for json output 2021-02-19 17:46:04 +01:00
Daniel Carrillo ef31af865a
Fix test 2021-02-19 17:45:07 +01:00
Daniel Carrillo fda5957a04
Bump version to 1.0.3 2020-12-28 14:50:15 +01:00
Daniel Carrillo 0b2f98fa4f
Fix license at setup.py 2020-12-28 14:01:44 +01:00
Daniel Carrillo e6756888e7
Ensure tests run for every push 2020-12-26 19:00:42 +01:00
Daniel Carrillo 3e03e532fd
Add badges to README.md 2020-12-26 18:50:48 +01:00
Daniel Carrillo ae7bf28702
Fix github workflow 2020-12-26 17:02:04 +01:00
7 changed files with 34 additions and 19 deletions

View File

@ -4,21 +4,22 @@ on:
push:
branches:
- main
tags:
- '*'
pull_request:
jobs:
tests:
runs-on: ${{ matrix.os }}
if: github.event_name == 'pull_request'
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
@ -37,14 +38,15 @@ jobs:
build_publish:
runs-on: ubuntu-latest
needs: tests
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v2
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11
- name: Install tools
run: |

View File

@ -1,19 +1,30 @@
# digaws
The digaws lookup tool displays information for a given IP address (v4 o v6) or a CIDR, sourced from the AWS official IP ranges.
The digaws lookup tool displays information for a given IP address (both v4 and v6) or a CIDR, sourced from the AWS official IP ranges.
In order to save bandwidth and time this tool requests the [AWS IP ranges](https://ip-ranges.amazonaws.com/ip-ranges.json) and keeps
a cached version until a new version is published.
[![PyPI version](https://badge.fury.io/py/digaws.svg)](https://pypi.org/project/digaws/)
[![CI](https://github.com/dcarrillo/digaws/workflows/CI/badge.svg)](https://github.com/dcarrillo/digaws/actions)
## Requirements
Python >= 3.7
Python >= 3.8
Tests are verified on Linux, macos and Windows.
## Install
### Using [pipx](https://pypa.github.io/pipx/#install-pipx) (this is the preferred way)
```bash
pip install digaws
pipx install digaws
```
### Using pip
```bash
pip install digaws --user
```
## Usage

View File

@ -1,2 +1,2 @@
__version__ = '1.0.2'
__version__ = '1.0.6'
__description__ = 'Look up canonical information for AWS IP addresses and networks'

View File

@ -127,8 +127,7 @@ class DigAWSPrettyPrinter:
item_dict.update({'network_border_group': prefix['network_border_group']})
data.append(item_dict)
if data:
print(json.dumps(data, indent=2))
print(json.dumps(data, indent=2))
class DigAWS():
@ -182,7 +181,7 @@ class DigAWS():
data = [prefix for prefix in self.ipv6_prefixes
if addr.subnet_of(prefix['ipv6_prefix'])]
except (ipaddress.AddressValueError, ValueError):
raise(ValueError(f'Wrong IP or CIDR format: {address}'))
raise ValueError(f'Wrong IP or CIDR format: {address}')
return data

View File

@ -1,10 +1,12 @@
import nox
nox.options.sessions = ['lint', 'typing', 'tests']
locations = ['noxfile.py', 'setup.py', 'digaws/', 'tests/']
lint_common_args = ['--max-line-length', '120']
mypy_args = ['--ignore-missing-imports']
mypy_args = ['--ignore-missing-imports', '--install-types', '--non-interactive']
pytest_args = ['--cov=digaws', '--cov-report=', 'tests/']
coverage_args = ['report', '--show-missing', '--fail-under=80']

View File

@ -17,7 +17,7 @@ setup(
url='http://github.com/dcarrillo/digaws',
author='Daniel Carrillo',
author_email='daniel.carrillo@gmail.com',
license='MIT',
license='Apache Software License',
packages=['digaws'],
zip_safe=False,
classifiers=[
@ -25,7 +25,7 @@ setup(
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
],
python_requires='>=3.7',
python_requires='>=3.8',
entry_points={
'console_scripts': ['digaws=digaws.digaws:main']
},

View File

@ -84,4 +84,5 @@ def test_get_aws_ip_ranges_invalid_status(mocker, fs, create_cache_dir) -> None:
with pytest.raises(digaws.UnexpectedRequestException) as e:
digaws.get_aws_ip_ranges()
assert e.startswith('Unexpected response from')
assert e.match('^Unexpected response from')