Skip to content

Commit 89937c9

Browse files
author
Alexandru Cheltuitor
committed
Merge branch 'fix/add-exception' into 'develop'
Fix/add exception See merge request ProtonVPN/linux/proton-python-client!40
2 parents 629d761 + 67425a5 commit 89937c9

File tree

7 files changed

+31
-13
lines changed

7 files changed

+31
-13
lines changed

arch/PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Maintainer: Proton Technologies AG <[email protected]>
22
pkgname=python-proton-client
3-
pkgver=0.5.0
3+
pkgver=0.5.1
44
pkgrel=1
55
pkgdesc="Safely login with ProtonVPN credentials to connect to Proton."
66
arch=("any")

debian/changelog

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
1+
proton-python-client (0.5.1-1) unstable; urgency=medium
2+
3+
* Add new exceptions for improved case handling
4+
5+
-- Proton Technologies AG <[email protected]> Mon, 24 May 2021 11:30:00 +0100
6+
17
proton-python-client (0.5.0-1) unstable; urgency=medium
28

39
* Add new exceptions
410
* Throw custom exceptions in case of network errors, abstracting from the package that is being used for requests
511

612
-- Proton Technologies AG <[email protected]> Fri, 30 Apr 2021 18:15:00 +0100
713

8-
proton-python-client (0.4.1-1) unstable; urgency=medium
14+
proton-python-client (0.4.1-1) unstable; urgency=medium
915

1016
* Add long description to setup.py
1117

1218
-- Proton Technologies AG <[email protected]> Wed, 21 Apr 2021 13:45:00 +0100
1319

14-
proton-python-client (0.4.0-1) unstable; urgency=medium
20+
proton-python-client (0.4.0-1) unstable; urgency=medium
1521

1622
* Add proxy support
1723
* Verify fingerprint of signer key
1824

1925
-- Proton Technologies AG <[email protected]> Mon, 19 Apr 2021 10:50:00 +0100
2026

21-
proton-python-client (0.3.0-1) unstable; urgency=medium
27+
proton-python-client (0.3.0-1) unstable; urgency=medium
2228

2329
* Set flags to BNs in the openssl implementation using BN_set_flags and BN_FLAG_CONSTTIME
2430

2531
-- Proton Technologies AG <[email protected]> Wed, 27 Jan 2021 12:12:23 +0000
2632

27-
proton-python-client (0.2.0-3) unstable; urgency=medium
33+
proton-python-client (0.2.0-3) unstable; urgency=medium
2834

2935
* Bugfix: Invalid modulus
3036
* Bugfix: Invalid salt

proton/api.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import base64
22
import json
3+
34
import gnupg
45
import requests
56

67
from .cert_pinning import TLSPinningAdapter
8+
from .constants import (DEFAULT_TIMEOUT, SRP_MODULUS_KEY,
9+
SRP_MODULUS_KEY_FINGERPRINT)
10+
from .exceptions import (ConnectionTimeOutError, NewConnectionError,
11+
ProtonError, TLSPinningError, UnknownConnectionError)
712
from .srp import User as PmsrpUser
8-
from .constants import DEFAULT_TIMEOUT, SRP_MODULUS_KEY, SRP_MODULUS_KEY_FINGERPRINT
9-
from .exceptions import ProtonError, TLSPinningError, NewConnectionError, UnknownConnectionError
1013

1114

1215
class Session:
@@ -101,6 +104,8 @@ def api_request(
101104
)
102105
except requests.exceptions.ConnectionError as e:
103106
raise NewConnectionError(e)
107+
except requests.exceptions.Timeout as e:
108+
raise ConnectionTimeOutError(e)
104109
except TLSPinningError as e:
105110
raise TLSPinningError(e)
106111
except (Exception, requests.exceptions.BaseHTTPError) as e:

proton/cert_pinning.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ def _new_pool(self, scheme, host, port, request_context):
154154
kwargs = self.connection_pool_kw
155155

156156
pool = TLSPinningHTTPSConnectionPool(
157-
host=host, port=port,
158-
hash_dict=self.hash_dict, **kwargs
159-
)
157+
host=host, port=port,
158+
hash_dict=self.hash_dict, **kwargs
159+
)
160160

161161
return pool
162162

proton/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
VERSION = "0.5.0"
2+
VERSION = "0.5.1"
33
DEFAULT_TIMEOUT = (10, 30)
44
PUBKEY_HASH_DICT = {
55
"api.protonvpn.ch": [

proton/exceptions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@ class NewConnectionError(ProtonNetworkError):
2525
"""Network Error"""
2626

2727

28+
class ConnectionTimeOutError(ProtonNetworkError):
29+
"""Connection Time Out Error"""
30+
31+
2832
class UnknownConnectionError(ProtonNetworkError):
2933
"""UnknownConnectionError"""

rpmbuild/SPECS/python3-proton-client.spec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
%define unmangled_name proton-client
2-
%define version 0.5.0
2+
%define version 0.5.1
33
%define release 1
44

55
Prefix: %{_prefix}
@@ -48,7 +48,10 @@ rm -rf $RPM_BUILD_ROOT
4848
%defattr(-,root,root)
4949

5050
%changelog
51-
* Wed Apr 21 2021 Proton Technologies AG <[email protected]> 0.5.0-1
51+
* Mon May 24 2021 Proton Technologies AG <[email protected]> 0.5.1-1
52+
- Add new exceptions for improved case handling
53+
54+
* Fri Apr 30 2021 Proton Technologies AG <[email protected]> 0.5.0-1
5255
- Add new exceptions
5356
- Throw custom exceptions in case of network errors, abstracting from the package that is being used for requests
5457

0 commit comments

Comments
 (0)