swap loop
This commit is contained in:
parent
e6328135da
commit
be9ad9b934
@ -78,15 +78,20 @@ class WPMenu:
|
|||||||
idMenu = 0
|
idMenu = 0
|
||||||
exist = False
|
exist = False
|
||||||
for i in ["categories", "tags"]:
|
for i in ["categories", "tags"]:
|
||||||
|
for index in range(1,10):
|
||||||
if exist is False:
|
if exist is False:
|
||||||
try:
|
try:
|
||||||
params = {"search":title, "per_page":"100"}
|
params = {"search":title, "per_page":"100", "page":index}
|
||||||
page = self._request_wordpress.get("{2}://{0}/wp-json/wp/v2/{1}".format(self._wordpress, i, self._protocol_wordpress), auth=self._basic, params=params)
|
page = self._request_wordpress.get("{2}://{0}/wp-json/wp/v2/{1}".format(self._wordpress, i, self._protocol_wordpress), auth=self._basic, params=params)
|
||||||
if page.status_code == 200:
|
if page.status_code == 200:
|
||||||
result = page.json()
|
result = page.json()
|
||||||
if len(result) > 0:
|
if len(result) > 0:
|
||||||
idMenu = result[0]["id"]
|
for j in result:
|
||||||
|
self._logger.info("{0} info : {1} {2}".format(self._name, j["name"], title))
|
||||||
|
if j["name"] == title:
|
||||||
|
idMenu = j["id"]
|
||||||
exist = True
|
exist = True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self._logger.error("{0} : {2} didn't get due status code : {1}".format(self._name, page.status_code, i))
|
self._logger.error("{0} : {2} didn't get due status code : {1}".format(self._name, page.status_code, i))
|
||||||
self._logger.debug("{0} : {1}".format(self._name, page.content))
|
self._logger.debug("{0} : {1}".format(self._name, page.content))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user