File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -576,10 +576,8 @@ async def get_total_category_pages(self, category):
576576 working_page = current_page
577577 current_page *= 2
578578
579- # Check the page in the middle of highest known working page and
580- # current page until they have the same page number.
581579 while True :
582- page = working_page + ( current_page - working_page ) / 2
580+ page = working_page + math . floor (( current_page - working_page ) / 2 )
583581 headers ["page" ] = str (page )
584582
585583 async with session .get (url , headers = headers ) as response :
@@ -590,9 +588,13 @@ async def get_total_category_pages(self, category):
590588 else :
591589 current_page = page
592590
593- if math . floor ( current_page ) == math . floor ( working_page ) :
591+ if current_page - 1 == working_page :
594592 break
595593
596- total_pages = math . floor ( working_page )
594+ total_pages = working_page
597595
598- return total_pages
596+ return {
597+ "code" : 200 ,
598+ "message" : "OK" ,
599+ "data" : {"total_pages" : total_pages },
600+ }
Original file line number Diff line number Diff line change @@ -539,10 +539,8 @@ def get_total_category_pages(self, category):
539539 working_page = current_page
540540 current_page *= 2
541541
542- # Check the page in the middle of highest known working page and
543- # current page until they have the same page number.
544542 while True :
545- page = working_page + ( current_page - working_page ) / 2
543+ page = working_page + math . floor (( current_page - working_page ) / 2 )
546544 headers ["page" ] = str (page )
547545
548546 response = requests .get (url , headers = headers , timeout = 10 )
@@ -553,10 +551,10 @@ def get_total_category_pages(self, category):
553551 else :
554552 current_page = page
555553
556- if math . floor ( current_page ) == math . floor ( working_page ) :
554+ if current_page - 1 == working_page :
557555 break
558556
559- total_pages = math . floor ( working_page )
557+ total_pages = working_page
560558
561559 return {
562560 "code" : 200 ,
You can’t perform that action at this time.
0 commit comments