cwoac / thingy_grabber

Script for archiving thingiverse things
MIT License
39 stars 10 forks source link

Rate Limits #30

Open coogle opened 2 months ago

coogle commented 2 months ago

While this project seems dead, I can tell people are still using it -- note that this code base while it does work great does NOT honor rate limits. I've run into problems with this.

I found the workaround answer was just to hack a time.sleep(30) into the loop where you download things (I am downloading collections) -- but I'm certain there is a more elegant solution.

Plutoaurus commented 1 week ago

Hi.

Can you give a line or area to put this pleease? Have tried in a few loops and still getting 429 error.

Thanks!!

coogle commented 1 week ago
        logging.info("Downloading {} thing(s).".format(self.total))
        for idx, thing in enumerate(self.things):
            logging.info("Downloading thing {} - {}".format(idx, thing))
            return_code = Thing(thing).download(self.download_dir, self.compress, self.api_key)
            time.sleep(5)
            if self.quick and return_code == State.ALREADY_DOWNLOADED:
                logging.info("Caught up, stopping.")
                return

Is what I did.