Skip to content

Commit

Permalink
Merge branch 'master' into add_youtube_downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
naisanzaa committed Sep 20, 2023
2 parents 575e703 + 1002b63 commit 3cf3b98
Show file tree
Hide file tree
Showing 55 changed files with 1,967 additions and 389 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Build docker
run: docker build . --tag ${{ env.IMAGE_NAME }}

Expand All @@ -61,7 +61,7 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Build docker
run: docker build . --tag ${{ env.IMAGE_NAME }}
- name: Run tests in docker
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
[![master](https://github.com/TheShellLand/automonisaur/actions/workflows/python37.yml/badge.svg)](https://github.com/TheShellLand/automonisaur/actions/workflows/python37.yml)
[![master](https://github.com/TheShellLand/automonisaur/actions/workflows/python36.yml/badge.svg)](https://github.com/TheShellLand/automonisaur/actions/workflows/python36.yml)

[![Downloads](https://pepy.tech/badge/automonisaur)](https://pepy.tech/project/automonisaur)
[![Downloads](https://pepy.tech/badge/automonisaur/month)](https://pepy.tech/project/automonisaur)
[![Downloads](https://pepy.tech/badge/automonisaur/week)](https://pepy.tech/project/automonisaur)
[![Downloads](https://static.pepy.tech/badge/automonisaur)](https://pepy.tech/project/automonisaur)
[![Downloads](https://static.pepy.tech/badge/automonisaur/month)](https://pepy.tech/project/automonisaur)
[![Downloads](https://static.pepy.tech/badge/automonisaur/week)](https://pepy.tech/project/automonisaur)

[//]: # ([![codecov](https://codecov.io/gh/TheShellLand/automonisaur/branch/master/graph/badge.svg)](https://codecov.io/gh/TheShellLand/automonisaur))

Expand All @@ -35,15 +35,20 @@ Github issues and feature requests welcomed.
### Integrations

- airport
- beautifulsoup
- elasticsearch
- facebook groups
- flask
- google auth api
- google people api
- google sheets api
- instagram
- logging
- minio
- neo4j
- nmap
- requests
- scrapy
- selenium
- sentryio
- slack
Expand Down
22 changes: 11 additions & 11 deletions automon/helpers/sleeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from automon.log import Logging

log = Logging('Sleeper', level=Logging.INFO)
log = Logging(name='Sleeper', level=Logging.INFO)


class Sleeper:
Expand All @@ -14,18 +14,18 @@ def seconds(caller: object or str, seconds: int) -> time.sleep:

sleep = seconds
if sleep < 2:
log.info(f'[{Sleeper.seconds.__name__}] '
log.debug(f'[{Sleeper.seconds.__name__}] '
f'[{caller}] sleeping for {sleep} second')
else:
log.info(f'[{Sleeper.seconds.__name__}] '
log.debug(f'[{Sleeper.seconds.__name__}] '
f'[{caller}] sleeping for {sleep} seconds')
return time.sleep(sleep)

@staticmethod
def minute(caller: object or str, sleep: int = 60) -> time.sleep:
"""Sleep for a minute"""

log.info(f'[{Sleeper.minute.__name__}] '
log.debug(f'[{Sleeper.minute.__name__}] '
f'[{caller}] sleeping for {sleep} seconds')
return time.sleep(sleep)

Expand All @@ -35,7 +35,7 @@ def within_a_minute(caller, sleep: int = None):

sleep = sleep if isinstance(sleep, int) else \
random.choice(range(1, 1 * 60))
log.info(f'[{Sleeper.within_a_minute.__name__}] '
log.debug(f'[{Sleeper.within_a_minute.__name__}] '
f'[{caller}] sleeping for {sleep} seconds')
return time.sleep(sleep)

Expand All @@ -44,7 +44,7 @@ def minutes(caller, minutes: int):
"""Sleep for this many minutes"""

sleep = minutes * 60
log.info(f'[{Sleeper.minutes.__name__}] '
log.debug(f'[{Sleeper.minutes.__name__}] '
f'[{caller}] sleeping for {sleep} minutes')
return time.sleep(sleep)

Expand All @@ -54,7 +54,7 @@ def hour(caller, hour: int = 1):

sleep = hour if not hour else random.choice(
range(1, hour * 60 * 60))
log.info(f'[{Sleeper.hour.__name__}] '
log.debug(f'[{Sleeper.hour.__name__}] '
f'[{caller}] sleeping for {sleep} seconds')
return time.sleep(sleep)

Expand All @@ -63,7 +63,7 @@ def hours(caller, hours):
"""Sleep for this many hours"""

sleep = hours * 60 * 60
log.info(f'[{Sleeper.hours.__name__}] '
log.debug(f'[{Sleeper.hours.__name__}] '
f'[{caller}] sleeping for {hours} hours')
return time.sleep(sleep)

Expand All @@ -73,7 +73,7 @@ def day(caller, hours: int = 24):

sleep = hours if not hours else random.choice(
range(1, hours * 60 * 60))
log.info(f'[{Sleeper.day.__name__}] '
log.debug(f'[{Sleeper.day.__name__}] '
f'[{caller}] sleeping for {sleep} seconds')
return time.sleep(sleep)

Expand All @@ -82,7 +82,7 @@ def daily(caller, hours: int = 24):
"""Sleep for one day"""

sleep = hours if not hours else hours * 60 * 60
log.info(f'[{Sleeper.daily.__name__}] '
log.debug(f'[{Sleeper.daily.__name__}] '
f'[{caller}] sleeping for {sleep} seconds')
return time.sleep(sleep)

Expand All @@ -92,6 +92,6 @@ def time_range(caller, seconds: int):
"""
sleep = seconds if not seconds else random.choice(
range(1, seconds))
log.info(f'[{Sleeper.time_range.__name__}] '
log.debug(f'[{Sleeper.time_range.__name__}] '
f'[{caller}] sleeping for {sleep} seconds')
return time.sleep(sleep)
1 change: 1 addition & 0 deletions automon/integrations/beautifulsoupWrapper/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .client import BeautifulSoupClient
24 changes: 24 additions & 0 deletions automon/integrations/beautifulsoupWrapper/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from bs4 import BeautifulSoup

from automon.log import Logging

log = Logging(name='BeautifulSoupClient', level=Logging.DEBUG)


class BeautifulSoupClient(object):

def __init__(self, bs: BeautifulSoup = None):
self.bs = bs

def read_markup(self, markup: str, features: str = 'lxml'):
"""read markup with beautifulsoup"""
try:
self.bs = BeautifulSoup(
markup=markup or self.markup,
features=features
)
log.info(f'read_markup success ({len(markup)} B)')
except Exception as e:
log.error(f'read_markup failed ({len(markup)} B): {e}')

return self
1 change: 1 addition & 0 deletions automon/integrations/facebook/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .groups import FacebookGroups
Loading

0 comments on commit 3cf3b98

Please sign in to comment.