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 83ac62e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions m3u8/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
import itertools
import re
from urllib.parse import urljoin as _urljoin
try:
from iso8601 import parse_date
except ImportError:
from datetime.datetime import fromisoformat as parse_date

import iso8601

from m3u8 import protocol

Expand All @@ -20,7 +23,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 83ac62e

Please sign in to comment.