subzeroid / instagrapi

🔥 The fastest and powerful Python library for Instagram Private API 2024
https://hikerapi.com/p/bkXQlaVe
MIT License
4.39k stars 686 forks source link

Feature Request: Completion of handle_exception.py with Full Example #1670

Open LeilaSchooley opened 11 months ago

LeilaSchooley commented 11 months ago

Feature Request: Completion of handle_exceptions.py with Full Example

https://github.com/subzeroid/instagrapi/blob/master/examples/handle_exception.py

Is your feature request related to a problem? Please describe. I have encountered difficulties while trying to implement exception handling in my project using Instagrapi. Specifically, the handle_exceptions.py file seems incomplete, and it lacks clear examples for integrating the update_client_settings, rebuild_client_settings, and freeze methods. This has made it challenging to effectively manage exceptions and maintain the stability of the client's state.

Describe the solution you'd like I would greatly appreciate it if the Instagrapi team could complete the handle_exceptions.py file and provide a comprehensive example. This example should include fully implemented update_client_settings, rebuild_client_settings, and freeze methods.

Ideally, this example would be straightforward enough for users to easily run and adapt to their specific needs. The goal is to have a clear reference on how to handle various exceptions while maintaining the client's settings and state effectively.

Describe alternatives you've considered I have tried piecing together the code from snippets found in the Telegram chat linked here https://github.com/subzeroid/instagrapi/issues/482 and other sources, but these are also incomplete and lack the context needed for full implementation.

def rebuild_client_settings(self, device):
        """Generate new session, change random device
        Help to reset Feedback Required
        """
        self.client_settings = self.build_client_settings(device)
        self.client = Client()
        self.client.login(self.username, self.password)
        return self.client_settings

    def build_client_settings(self, device=None):
        """Build device and user agent settings"""
        self.device = device
        if not self.device:
            # Assuming there is a method to get a random device
            self.device = self.get_random_device()  # Replace with actual method to get a random device
        self.client_settings = {
            'device_settings': self.device.settings,
            'user_agent': self.device.build_user_agent()
        }
        # Assuming there is a method to save these settings
        self.save_client_settings()  # Replace with actual method to save settings
        return self.client_settings

    def update_client_settings(self, settings):
        self.client_settings = settings
        # Assuming there is a method to save these settings
        self.save_client_settings()  # Replace with actual method to save settings
        return True

While I understand the concept behind these methods, having a complete, working example would significantly streamline the development process and reduce the potential for errors.

Additional context I've noticed that there are others in the community facing similar challenges. Completing this part of the documentation and providing a full example would not only aid my project but also benefit the broader Instagrapi user community. It would enhance the usability of the library, especially for handling complex scenarios that require robust exception management.


LeilaSchooley commented 11 months ago

@jarrodnorwell can you be of any assistance?

jarrodnorwell commented 11 months ago

@LeilaSchooley I'll take a look and see if it's something I'll be able to do

LeilaSchooley commented 11 months ago

@LeilaSchooley I'll take a look and see if it's something I'll be able to do

Great, thanks. Also tagging in

@adityaa-codes, @noqcks, @subzeroid, @vltclz, @Jammy108, @nil-malh, @jashparekh, @elmissouri16, @a13sha, @Phelan164, @ANaddafi, @stampixel, @BlackPhoenix134, @Sebo-the-tramp, @mertyuce1, @ghrlt, @tonycpsu, @truroshan, @Leraner, @rickturner2001, @claell, @6ky, @catalyys, @nebula0225, @msk-psp, @muhammadashir4, @bilakos26, @trevtravtrev, @Xartoks, @gabrielloliveira, @ljcanales, @JulienMaille, @trashmit, @markdrrr, @imvickykumar999, @Tlaloc-Es, @mur28, @DakaRRR, @MeatyAri, @cturan, @firmeldir, @cskartikey, @akdev-tech, @100rmk, @dheeraj009joshi, @muhammeddilaver, @skords, @mohammad330a, @windowpane, @adrian-casanova

LeilaSchooley commented 11 months ago

@reddere, @SK4P3, @tkorchagin, @Ameer5CT, @xliee, @asbestossupply, @naisukhy, @HellBoy-OP, @howardtmarin, @will-holley, @MehdiMJ1, @emmacooperpeterson, @dougwettlaufer, @yeeyou, @dmunozv04, @theiltho, @just-claudio, @OPHoperHPO, @wpbloger, @bedefaced, @ohld.

elmissouri16 commented 11 months ago

@LeilaSchooley I'll take a look and see if it's something I'll be able to do

Great, thanks. Also tagging in

@adityaa-codes, @noqcks, @subzeroid, @vltclz, @Jammy108, @nil-malh, @jashparekh, @elmissouri16, @a13sha, @Phelan164, @ANaddafi, @stampixel, @BlackPhoenix134, @Sebo-the-tramp, @mertyuce1, @ghrlt, @tonycpsu, @truroshan, @Leraner, @rickturner2001, @claell, @6ky, @catalyys, @nebula0225, @msk-psp, @muhammadashir4, @bilakos26, @trevtravtrev, @Xartoks, @gabrielloliveira, @ljcanales, @JulienMaille, @trashmit, @markdrrr, @imvickykumar999, @Tlaloc-Es, @mur28, @DakaRRR, @MeatyAri, @cturan, @firmeldir, @cskartikey, @akdev-tech, @100rmk, @dheeraj009joshi, @muhammeddilaver, @skords, @mohammad330a, @windowpane, @adrian-casanova

dude this how you make people hate and dont wanna help you dont tag people like this

LeilaSchooley commented 11 months ago

Apologies, but other people are facing this issue as well - this is also a bug as the methods are not properly defined. Your help would be much appreciated.

stampixel commented 11 months ago

Boohoo, you are really self entitled.

BlackPhoenix134 commented 11 months ago

@SK4P3 https://github.com/LeilaSchooley/Get-Free-V-Bucks Do you want free V bucks from this guy? You sure do!

SK4P3 commented 11 months ago

@BlackPhoenix134 only Robux!

adityaa-codes commented 11 months ago

you cant tag anyone like this man @LeilaSchooley

LeilaSchooley commented 11 months ago

Dear @jarrodnorwell, were you able to look into this? Many thanks.

@LeilaSchooley I'll take a look and see if it's something I'll be able to do