Skip to content

Commit

Permalink
selenium: remove requests
Browse files Browse the repository at this point in the history
it's getting sites blocked
  • Loading branch information
naisanzaa committed Nov 27, 2023
1 parent 9da6cf5 commit e6e94eb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
1 change: 0 additions & 1 deletion automon/integrations/facebook/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,6 @@ def to_dict(self):
title=self.title(),
url=self.url,
visible=self.visible(),
status=self._browser.request_status,
)

def quit(self):
Expand Down
16 changes: 0 additions & 16 deletions automon/integrations/seleniumWrapper/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from automon.helpers.dates import Dates
from automon.helpers.sleeper import Sleeper
from automon.helpers.sanitation import Sanitation
from automon.integrations.requestsWrapper import RequestsClient

from .config import SeleniumConfig
from .user_agents import SeleniumUserAgentBuilder
Expand All @@ -33,13 +32,11 @@ def __init__(self, config: SeleniumConfig = None):
"""A selenium wrapper"""

self._config = config or SeleniumConfig()
self.request = None

def __repr__(self):
try:
return str(dict(
webdriver=self.webdriver.name or None,
request_status=self.request_status,
window_size=self.window_size,
))
except Exception as error:
Expand Down Expand Up @@ -90,14 +87,6 @@ def refresh(self):
self.webdriver.refresh()
log.info(f'{True}')

@property
def request_status(self):
if self.request is not None:
try:
return self.request.results.status_code
except:
pass

@property
def url(self):
return self.current_url
Expand Down Expand Up @@ -327,20 +316,15 @@ def get(self, url: str, **kwargs) -> bool:
"""get url"""
try:
if self.webdriver.get(url, **kwargs) is None:
self.request = RequestsClient(url=url)

log.info(str(dict(
url=url,
current_url=self._current_url,
request_status=self.request_status,
kwargs=kwargs
)))
return True
except Exception as error:
self.request = RequestsClient(url=url)
log.error(str(dict(
error=error,
request_status=self.request_status
)))

return False
Expand Down

0 comments on commit e6e94eb

Please sign in to comment.