diff --git a/.gitattributes b/.gitattributes index 5966153..c252504 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ .gitattributes export-ignore .gitignore export-ignore +README.md export-ignore diff --git a/pbincli/__init__.py b/pbincli/__init__.py index cdc0096..831f5c6 100644 --- a/pbincli/__init__.py +++ b/pbincli/__init__.py @@ -2,6 +2,6 @@ # -*- coding: utf-8 -*- __author__ = "R4SAS " -__version__ = "0.2.2b1" +__version__ = "0.3.0" __copyright__ = "Copyright (c) R4SAS" __license__ = "MIT" diff --git a/pbincli/api.py b/pbincli/api.py index 3b4bf41..fe76d77 100644 --- a/pbincli/api.py +++ b/pbincli/api.py @@ -98,8 +98,19 @@ class Shortener: def _yourls_init(self, settings): if not settings['short_url']: PBinCLIError("YOURLS: An API URL is required") - self.apiurl = settings['short_url'] + # setting API URL + apiurl = settings['short_url'] + if apiurl.endswith('/yourls-api.php'): + self.apiurl = apiurl + elif apiurl.endswith('/'): + self.apiurl = apiurl + 'yourls-api.php' + else: + PBinCLIError("YOURLS: Incorrect URL is provided.\n" + + "It must contain full address to 'yourls-api.php' script (like https://example.com/yourls-api.php)\n" + + "or just contain instance URL with '/' at the end (like https://example.com/)") + + # validating for required credentials if settings['short_user'] and settings['short_pass'] and settings['short_token'] is None: self.auth_args = {'username': settings['short_user'], 'password': settings['short_pass']} elif settings['short_user'] is None and settings['short_pass'] is None and settings['short_token']: