Skip to content

Commit b8a1479

Browse files
authored
add docstrings
1 parent 2df97c2 commit b8a1479

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

rotator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Used modules"""
12
import enum
23
import gitlab
34
import requests
@@ -6,6 +7,7 @@
67
from dateutil.relativedelta import relativedelta
78

89
def main():
10+
"""Simple script which rotate GitLab access tokens and send result to Telegram."""
911
try:
1012
parser = argparse.ArgumentParser(
1113
prog='script for rotate GitLab access tokens',
@@ -33,7 +35,7 @@ class TokenType(enum.Enum):
3335
PROJECT_ACCESS_TOKEN = 1
3436

3537
def check_and_rotate_tokens(gitlab_url: str, gitlab_token : str, token_type: TokenType):
36-
38+
"""Function which rotate GitLab access tokens."""
3739
gl = gitlab.Gitlab(url=gitlab_url, private_token=gitlab_token)
3840

3941
today_date = dt.today().strftime('%Y-%m-%d')
@@ -68,6 +70,7 @@ def check_and_rotate_tokens(gitlab_url: str, gitlab_token : str, token_type: Tok
6870
return debug_message
6971

7072
def send_to_telegram(telegram_bot_token: str, telegram_chat_id: str, telegram_message: str):
73+
"""Function which send message to Telegram."""
7174
send_url = f'https://api.telegram.org/bot{telegram_bot_token}/sendMessage'
7275

7376
if telegram_message.count('\n') >= 4:
@@ -81,6 +84,7 @@ def send_to_telegram(telegram_bot_token: str, telegram_chat_id: str, telegram_me
8184
print('No token issues.')
8285

8386
def divide_telegram_message(telegram_message: str):
87+
"""Function which divide Telegram message on two parts."""
8488
first_message_part = ''
8589
second_message_part = ''
8690

0 commit comments

Comments
 (0)