Skip to content

Fix Python 3.12 compatibility: remove use_2to3, fix urllib imports, u… #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion embedly/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import absolute_import
from .client import Embedly

__version__ = '0.5.0.post0'
__version__ = '0.5.0.post1'
11 changes: 8 additions & 3 deletions embedly/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@
import re
import httplib2
import json
from urllib import quote, urlencode
try:
# Python 3
from urllib.parse import quote, urlencode
except ImportError:
# Python 2
from urllib import quote, urlencode

from .models import Url

Expand Down Expand Up @@ -142,8 +147,8 @@ def _get(self, version, method, url_or_urls, **kwargs):
'error_code': int(resp['status'])}

if multi:
return map(lambda url, data: Url(data, method, url),
url_or_urls, data)
return list(map(lambda url, data: Url(data, method, url),
url_or_urls, data))

return Url(data, method, url_or_urls)

Expand Down
15 changes: 9 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,20 @@ def get_version():
tests_require=tests_require,
test_suite="embedly.tests",
zip_safe=True,
use_2to3=True,
# Removed use_2to3=True for Python 3.12 compatibility
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
]
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
],
python_requires='>=3.8',
)