From 796e18e700eaadd653863677e38c33b1db70955d Mon Sep 17 00:00:00 2001 From: Mariusz Woloszyn Date: Tue, 4 Apr 2023 18:29:20 +0200 Subject: [PATCH] collections.Iterable is deprecated --- wordpress_xmlrpc/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wordpress_xmlrpc/base.py b/wordpress_xmlrpc/base.py index d2f4f83..18f896e 100644 --- a/wordpress_xmlrpc/base.py +++ b/wordpress_xmlrpc/base.py @@ -1,9 +1,13 @@ -import collections import sys from wordpress_xmlrpc.compat import xmlrpc_client, dict_type from wordpress_xmlrpc.exceptions import ServerConnectionError, UnsupportedXmlrpcMethodError, InvalidCredentialsError, XmlrpcDisabledError +try: + from collections.abc import Iterable # noqa +except ImportError: + from collections import Iterable # noqa + class Client(object): """ @@ -126,7 +130,7 @@ def process_result(self, raw_result): if self.results_class and raw_result: if isinstance(raw_result, dict_type): return self.results_class(raw_result) - elif isinstance(raw_result, collections.Iterable): + elif isinstance(raw_result, Iterable): return [self.results_class(result) for result in raw_result] return raw_result