From d98df5f02b7f9741c137c55c9b6395d8d198e498 Mon Sep 17 00:00:00 2001 From: Sean Whalen Date: Sun, 4 Mar 2018 16:03:37 -0500 Subject: [PATCH] 2.0.1 --- CHANGELOG.md | 5 +++++ README.rst | 2 +- docs/index.rst | 2 +- parsedmarc.py | 22 +++++++--------------- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79cbd12..307bf14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +2.0.1 +----- + +- Fix documentation +- Remove Python 2 code 2.0.0 ----- diff --git a/README.rst b/README.rst index b0177dd..b63092c 100644 --- a/README.rst +++ b/README.rst @@ -174,7 +174,7 @@ macOS or Linux, run .. code-block:: bash - $ sudo -H pip3 install -U checkdmarc + $ sudo -H pip3 install -U parsedmarc Or, install the latest development release directly from GitHub: diff --git a/docs/index.rst b/docs/index.rst index f1e4cba..cdefa28 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -179,7 +179,7 @@ macOS or Linux, run .. code-block:: bash - $ sudo -H pip3 install -U checkdmarc + $ sudo -H pip3 install -U parsedmarc Or, install the latest development release directly from GitHub: diff --git a/parsedmarc.py b/parsedmarc.py index d28be5d..af464cc 100644 --- a/parsedmarc.py +++ b/parsedmarc.py @@ -1,12 +1,9 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- """A Python module and CLI for parsing DMARC reports""" -from __future__ import unicode_literals, print_function, absolute_import - import logging -from sys import version_info import os import json from datetime import datetime @@ -41,17 +38,12 @@ import imapclient.exceptions import dateparser import mailparser -__version__ = "2.0.0" +__version__ = "2.0.1" logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) -# Python 2 comparability hack -if version_info[0] >= 3: - unicode = str - - feedback_report_regex = re.compile(r"^([\w\-]+): (.+)$", re.MULTILINE) @@ -225,14 +217,14 @@ def _get_ip_address_country(ip_address): """ url = "https://geolite.maxmind.com/download/geoip/database/" \ "GeoLite2-Country.tar.gz" - origional_filename = "GeoLite2-Country.mmdb" + original_filename = "GeoLite2-Country.mmdb" tar_file = tarfile.open(fileobj=BytesIO(get(url).content), mode="r:gz") tar_dir = tar_file.getnames()[0] - tar_path = "{0}/{1}".format(tar_dir, origional_filename) + tar_path = "{0}/{1}".format(tar_dir, original_filename) tar_file.extract(tar_path) shutil.move(tar_path, ".") shutil.rmtree(tar_dir) - if location != origional_filename: + if location != original_filename: shutil.move("GeoLite2-Country.mmdb", location) system_paths = ["/usr/local/share/GeoIP/GeoLite2-Country.mmdb", @@ -491,7 +483,7 @@ def extract_xml(input_): str: The extracted XML """ - if type(input_) == str or type(input_) == unicode: + if type(input_) == str: file_object = open(input_, "rb") elif type(input_) == bytes: file_object = BytesIO(input_) @@ -966,7 +958,7 @@ def parse_report_file(input_, nameservers=None, timeout=6.0): Returns: OrderedDict: The parsed DMARC report """ - if type(input_) == str or type(input_) == unicode: + if type(input_) == str: file_object = open(input_, "rb") elif type(input_) == bytes: file_object = BytesIO(input_)