Verify if account is Private :param browser: The selenium webdriver instance :param logger: the logger instance :param following: Not accessed :return: None if profile cannot be verified
(browser, logger, following=True)
| 68 | |
| 69 | |
| 70 | def is_private_profile(browser, logger, following=True): |
| 71 | """ |
| 72 | Verify if account is Private |
| 73 | |
| 74 | :param browser: The selenium webdriver instance |
| 75 | :param logger: the logger instance |
| 76 | :param following: Not accessed |
| 77 | :return: None if profile cannot be verified |
| 78 | """ |
| 79 | |
| 80 | try: |
| 81 | # Get profile owner information |
| 82 | shared_data = get_shared_data(browser) |
| 83 | |
| 84 | # Sometimes shared_data["entry_data"]["ProfilePage"][0] is empty, but get_additional_data() |
| 85 | # fetches all data needed |
| 86 | get_key = shared_data.get("entry_data").get("ProfilePage") |
| 87 | |
| 88 | if get_key: |
| 89 | data = get_key[0] |
| 90 | else: |
| 91 | data = get_additional_data(browser) |
| 92 | finally: |
| 93 | is_private = data["graphql"]["user"]["is_private"] |
| 94 | |
| 95 | logger.info( |
| 96 | "Checked if '{}' is private, and it is: '{}'".format( |
| 97 | data["graphql"]["user"]["username"], is_private |
| 98 | ) |
| 99 | ) |
| 100 | |
| 101 | return is_private |
| 102 | |
| 103 | |
| 104 | # Evaluate a mandatory words list against a text |
no test coverage detected