Skip to content

Commit

Permalink
Fixed bug and renamed function "get_link" to "create_parser"
Browse files Browse the repository at this point in the history
  • Loading branch information
Taralas209 committed Mar 24, 2023
1 parent 05589cc commit 685e001
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,19 @@ def is_bitlink(link, access_token):
return linkstatus_response.ok


def get_link():
def create_parser():
parser = argparse.ArgumentParser()
parser.add_argument('--link', type=str, help='Введите ссылку', default='test.test')
parser.add_argument('--link_title', type=str, help='Введите название ссылки', default='another bitlink')
args = parser.parse_args()
link = args.link
link_title = args.custom_title
return link, link_title
return parser.parse_args()


def main():
load_dotenv()
access_token = os.environ['BITLY_ACCESS_TOKEN']
link, link_title = get_link()
parser = create_parser()
link = parser.link
link_title = parser.link_title
try:
if is_bitlink(link, access_token):
clicks_count = count_link_clicks(link, access_token)
Expand Down

0 comments on commit 685e001

Please sign in to comment.