Skip to content

Commit

Permalink
Use built-in ISO 8601 parse for Python 3.11 and later
Browse files Browse the repository at this point in the history
  • Loading branch information
daveisfera committed Oct 16, 2023
1 parent c741a8e commit 024e9bf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions m3u8/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
import re
from urllib.parse import urljoin as _urljoin

import iso8601
try:
from iso8601 import parse_date
except ImportError:
parse_date = datetime.datetime.fromisoformat


from m3u8 import protocol

Expand All @@ -20,7 +24,7 @@


def cast_date_time(value):
return iso8601.parse_date(value)
return parse_date(value)


def format_date_time(value, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
iso8601
iso8601; python_version < '3.11'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
url="https://github.com/globocom/m3u8",
description="Python m3u8 parser",
long_description=long_description,
python_requires=">=3.6",
python_requires=">=3.7",
)

0 comments on commit 024e9bf

Please sign in to comment.