Forum Settings
Forums

Is it normal for it to take 2 secs per request on user list requests?

New
Mar 8, 2024 6:05 PM
#1
Offline
Jul 2023
10
    with requests.Session() as session:
        api_url = f"https://api.myanimelist.net/v2/users/{a}/animelist"
        tis = time.time()
        offset = 0
        params = {
            #"status": zz,
            "limit": 1000,
            "offset": offset,
            "sort": "list_score",
            # "fields": "id, mean",
            "fields": "list_status",
            "nsfw": True,
        }
        try:
            response = session.get(api_url, params=params, headers=headers)


This took exactly 2.272427797317505 secs last time, and it averages around the same time the other times as well. Is this normal?
Reply Disabled for Non-Club Members
Mar 9, 2024 9:33 AM
#2

Offline
Feb 2020
972
The more you request per page, the longer the request will take since the query needs to queue more stuff internally. That having been said, it's not going to be much faster if you page 500 twice or 100 ten times so that's probably your best bet, assuming you just want all the data at the end of the day.

If you want a fast response to asynchronously display data as it loads, I recommend smaller loads (like the default 100 which executes fast). Just know that it'll take longer to load everything then, although you'll have stuff to display almost immediately.

edit: but yeah, 2 seconds is very normal for that from my experience.
Please sign up for MangAlert! It's a little project I made that I'd really like to see the light of day and some users.

MangAlert! (please sign up!)
GitHub Repo (please star!)
Reply Disabled for Non-Club Members

More topics from this board

» I built a spotify-styled 'MyAnimeList Wrapped' for a yearly review of your anime and manga

XAvishkar - Dec 14

1 by Joeliazeers »»
Dec 17, 1:01 PM

» [Repost] list of all relation_type and media_type.

Mr_UnknownOtaku - Dec 8

4 by -DxP- »»
Dec 12, 8:43 AM

» How to get author name?

EdibleMuffin - Feb 12

4 by XAvishkar »»
Dec 8, 9:52 AM

» 401 Unauthorized when doing authorization flow

Konng_ - Nov 16

2 by Konng_ »»
Nov 28, 3:24 PM

» [discontinued] I made a webapp to compare plan-to-watch lists

daux - Apr 16, 2022

33 by daux »»
Oct 2, 4:17 PM
It’s time to ditch the text file.
Keep track of your anime easily by creating your own list.
Sign Up Login