Skip to content

Commit

Permalink
facebook: remove screenshots because it's making too much I/O calls
Browse files Browse the repository at this point in the history
  • Loading branch information
naisanzaa committed Oct 9, 2024
1 parent 4a0cec7 commit 1cee1c5
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions automon/integrations/facebook/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def content_unavailable(self):
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
logger.error(f'{self.url} :: {message=} :: {session=} :: {stacktrace=}')
self.screenshot_error()

def creation_date(self):

Expand All @@ -74,7 +73,6 @@ def creation_date(self):
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
logger.error(f'{self.url} :: {message=} :: {session=} :: {stacktrace=}')
self.screenshot_error()

def creation_date_timestamp(self):
if self.creation_date():
Expand Down Expand Up @@ -126,7 +124,6 @@ def history(self):
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
logger.error(f'{self.url} :: {message=} :: {session=} :: {stacktrace=}')
self.screenshot_error()

def temporarily_blocked(self):
try:
Expand All @@ -137,7 +134,6 @@ def temporarily_blocked(self):
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
logger.error(f'{self.url} :: {message=} :: {session=} :: {stacktrace=}')
self.screenshot_error()

def members(self):

Expand All @@ -155,7 +151,6 @@ def members(self):
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
logger.error(f'{self.url} :: {message=} :: {session=} :: {stacktrace=}')
self.screenshot_error()

def members_count(self):

Expand All @@ -177,7 +172,6 @@ def must_login(self):
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
logger.error(f'{self.url} :: {message=} :: {session=} :: {stacktrace=}')
self.screenshot_error()

def posts_monthly(self):

Expand All @@ -194,7 +188,6 @@ def posts_monthly(self):
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
logger.error(f'{self.url} :: {message=} :: {session=} :: {stacktrace=}')
self.screenshot_error()

def posts_monthly_count(self):

Expand Down Expand Up @@ -222,7 +215,6 @@ def posts_today(self):
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
logger.error(f'{self.url} :: {message=} :: {session=} :: {stacktrace=}')
self.screenshot_error()

def posts_today_count(self):

Expand Down Expand Up @@ -262,7 +254,6 @@ def privacy(self):
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
logger.error(f'{self.url} :: {message=} :: {session=} :: {stacktrace=}')
self.screenshot_error()

def privacy_details(self):

Expand All @@ -288,7 +279,6 @@ def privacy_details(self):
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
logger.error(f'{self.url} :: {message=} :: {session=} :: {stacktrace=}')
self.screenshot_error()

def title(self) -> str:

Expand All @@ -302,7 +292,6 @@ def title(self) -> str:
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
logger.error(f'{self.url} :: {message=} :: {session=} :: {stacktrace=}')
self.screenshot_error()

@property
def url(self) -> str:
Expand Down Expand Up @@ -341,7 +330,6 @@ def visible(self) -> str:
except Exception as error:
message, session, stacktrace = self.error_parsing(error)
logger.error(f'{self.url} :: {message=} :: {session=} :: {stacktrace=}')
self.screenshot_error()

@staticmethod
def error_parsing(error, enable_stacktrace: bool = False) -> tuple:
Expand All @@ -368,7 +356,6 @@ def get(self, url: str) -> bool:

result = self._browser.get(url=url)
logger.info(f'{url} :: {result}')
self.screenshot()

end = datetime.datetime.now().timestamp()
seconds_elapsed = int(end - start)
Expand All @@ -388,7 +375,7 @@ def get_about(self, rate_limiting: bool = True):
result = self.get(url=url)

logger.info(f'{url} :: {result=}')
self.screenshot()

return result

def get_with_rate_limiter(
Expand Down Expand Up @@ -417,7 +404,7 @@ def get_with_rate_limiter(
self.rate_limit_decrease()

result = self.get(url=url)
self.screenshot()

logger.info(f'get_with_rate_limiter :: {result}')
return result

Expand Down Expand Up @@ -452,16 +439,16 @@ def rate_limited(self):
"""rate limit checker"""
if self.current_rate_too_fast():
logger.info(f'rate_limited :: True')
self.screenshot()

return True

if self.temporarily_blocked() or self.must_login():
logger.info(f'rate_limited :: True')
self.screenshot()

return True

logger.error(f'rate_limited :: False')
self.screenshot()

return False

def run(self):
Expand Down

0 comments on commit 1cee1c5

Please sign in to comment.