Browse Source

0.3.0

New:
* Added validation of PrivateBin instance URL - #18 (it must contain trailing slash because POST is used)
* URL shortener support with various supported services - #19
* Shortener configuration, certificate validation and insecure warning settings can be configured in config file or via env

Changed:
* Restructured some parts of code by splitting big code chunks in funtions (encrypt/decrypt)
* Rework error messaging repeatable code (moved in utils)
* Reduce code duplication (requests session configuring)

Signed-off-by: r4sas <r4sas@i2pmail.org>
dependabot/add-v2-config-file 0.3.0
R4SAS 5 years ago
parent
commit
682b47fbd3
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 1
      .gitattributes
  2. 2
      pbincli/__init__.py
  3. 13
      pbincli/api.py

1
.gitattributes vendored

@ -1,2 +1,3 @@ @@ -1,2 +1,3 @@
.gitattributes export-ignore
.gitignore export-ignore
README.md export-ignore

2
pbincli/__init__.py

@ -2,6 +2,6 @@ @@ -2,6 +2,6 @@
# -*- coding: utf-8 -*-
__author__ = "R4SAS <r4sas@i2pmail.org>"
__version__ = "0.2.2b1"
__version__ = "0.3.0"
__copyright__ = "Copyright (c) R4SAS"
__license__ = "MIT"

13
pbincli/api.py

@ -98,8 +98,19 @@ class Shortener: @@ -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']:

Loading…
Cancel
Save