Overview
Client library for macaddress.io in Python language.
Free software: MIT
Installation
pip install maclookup
or
git clone https://github.com/CodeLineFi/maclookup-python.git pip install -e /path_to_sdist/
or
cd /path_to_sdist/ python setup.py install
or
cd /path_to_sdist/ easy_install .
Sample code
from maclookup import ApiClient
import logging
client = ApiClient('Your API key')
logging.basicConfig(filename='myapp.log', level=logging.WARNING)
print(client.get_raw_data('00A043AAAAAA', 'json'))
print(client.get_vendor('BBA043AAAAAA'))
print(client.get('BBA043AAAAAA'))
response = client.get('00A043AAAAAA')
print(response.vendor_details.is_private)
print(response.block_details.date_created)
Examples
You may find some examples in the “examples” directory. To run these examples you need to install “maclookup” package. Then you need to create an account on macaddress.io. The last step is to define environment variables with the value of your API key and other settings.
export API_KEY=<Your API key> export LOG_FILENAME=myapp.log export OUTPUT_FILENAME=result.csv
Documentation
maclookup package contains the API client class ApiClient, which implements the following functionality
ApiClient methods list:
- get(mac): ResponseModel
Returns ResponseModel object as a parsed API response for a given MAC address or OUI
- get_vendor(mac): string
Returns the company name as text
- get_raw_data(mac, output_format): string
Returns non-parsed API response as string
- set_base_url(url)
Sets base url to url
- set_requester(requester)
Sets instance of Requester
ResponseModel fields:
vendor_details: VendorDetails
block_details: BlockDetails
mac_address_details: MacAddressDetails
VendorDetails fields:
oui: string
is_private: boolean (False|True)
company_name: string
company_address: string
country_code: string
BlockDetails fields:
block_found: boolean (False|True)
border_left: string (MAC address, may be in the EUI-64)
border_right: string (MAC address, may be in the EUI-64)
block_size: int (long long int)
assignment_block_size: string
date_created: instance of datetime.datetime
date_updated: instance of datetime.datetime
MacAddressDetails fields:
search_term: string
is_valid: boolean (False|True)
transmission_type: string
administration_type: string
If the server returns a marker of outdated API version, this library will write a warning to the log.
Development
To install dev requirements, you need to run the following commands:
cd /path_to_sdist/ pip install -e .[dev]
To run unit tests, you may use the following command:
cd /path_to_sdist/ python -m unittest discover . "*_test.py"
or this one
cd /path_to_sdist/ tox
Changelog
1.0.0 (2018-08-01)
First release on PyPI.
Metadata
Release files for maclookup 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| maclookup-1.0.3.tar.gz | 11.4 kB | Without provenance | Details for maclookup-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| maclookup-1.0.3-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for maclookup-1.0.3-py2.py3-none-any.whl |
Total release size: 21.5 kB
Release files / maclookup-1.0.3.tar.gz
| Download URL | maclookup-1.0.3.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
795e792cd3e03c9bdad77e52904d43ff71d3ac03b360443f99d4bae08a6bffef
|
|
BLAKE2b-256 checksum How to use checksums |
d15959bb372710df70d63ccf9e30f44640eec2bd2da4e6d0952daca14713f02f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
|
Release files / maclookup-1.0.3-py2.py3-none-any.whl
| Download URL | maclookup-1.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
33bf8eaebe3b1e4ab4ae9277dd93c78024e0ebf6b3c42f76c37695bc26ce287a
|
|
BLAKE2b-256 checksum How to use checksums |
bda951ff3821d599a8b91fdcf380ee3c594f2009975d798e53968664db76b321
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
|
Security for maclookup 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.