Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-protonvpn-nm-lib for 
openSUSE:Factory checked in at 2022-11-30 16:51:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-protonvpn-nm-lib (Old)
 and      /work/SRC/openSUSE:Factory/.python-protonvpn-nm-lib.new.1597 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-protonvpn-nm-lib"

Wed Nov 30 16:51:44 2022 rev:6 rq:1039120 version:3.14.0

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-protonvpn-nm-lib/python-protonvpn-nm-lib.changes
  2022-07-04 11:32:49.972019059 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-protonvpn-nm-lib.new.1597/python-protonvpn-nm-lib.changes
        2022-11-30 16:51:45.301380599 +0100
@@ -1,0 +2,8 @@
+Mon Nov 28 14:07:39 UTC 2022 - Alexandre Vicenzi <alexandre.vice...@suse.com>
+
+- Update to 3.14.0
+  * When vpn session is invalid and an api request is made, ensure that user 
is logged out
+  * Properly handle session refresh
+  * Display propper error message when unable to establish VPN tunnel
+
+-------------------------------------------------------------------

Old:
----
  protonvpn-nm-lib-3.11.0.tar.gz

New:
----
  protonvpn-nm-lib-3.14.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-protonvpn-nm-lib.spec ++++++
--- /var/tmp/diff_new_pack.MHIDcA/_old  2022-11-30 16:51:45.833383434 +0100
+++ /var/tmp/diff_new_pack.MHIDcA/_new  2022-11-30 16:51:45.841383477 +0100
@@ -21,7 +21,7 @@
 # test suite requires network connection, you can test locally with `rpmbuild 
--with test`
 %bcond_with test
 Name:           python-protonvpn-nm-lib
-Version:        3.11.0
+Version:        3.14.0
 Release:        0
 Summary:        Proton VPN NetworkManager library
 License:        GPL-3.0-or-later

++++++ protonvpn-nm-lib-3.11.0.tar.gz -> protonvpn-nm-lib-3.14.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/protonvpn-nm-lib-3.11.0/.gitlab-ci.yml 
new/protonvpn-nm-lib-3.14.0/.gitlab-ci.yml
--- old/protonvpn-nm-lib-3.11.0/.gitlab-ci.yml  2022-05-31 16:19:23.000000000 
+0200
+++ new/protonvpn-nm-lib-3.14.0/.gitlab-ci.yml  2022-10-20 17:13:58.000000000 
+0200
@@ -70,18 +70,12 @@
  extends: make-image-deb
  script:
    - make image-fed36 branch=$CI_COMMIT_REF_SLUG src=fedora36
-   
-make-image-fed34:
- stage: image
- extends: make-image-deb
- script:
-   - make image-fed34 branch=$CI_COMMIT_REF_SLUG src=fedora34
-   
-make-image-fed35:
+
+make-image-fed37:
  stage: image
  extends: make-image-deb
  script:
-   - make image-fed35 branch=$CI_COMMIT_REF_SLUG src=fedora35
+   - make image-fed37 branch=$CI_COMMIT_REF_SLUG src=fedora37
 
 ######### CI Test Jobs ##########
 test-deb:
@@ -105,18 +99,12 @@
  needs:
    - job: make-image-fed36
  image: $CI_REGISTRY_IMAGE/fedora36:branch-$CI_COMMIT_REF_SLUG
- 
-test-fed34:
- extends: test-deb
- needs:
-   - job: make-image-fed34
- image: $CI_REGISTRY_IMAGE/fedora34:branch-$CI_COMMIT_REF_SLUG
- 
-test-fed35:
+
+test-fed37:
  extends: test-deb
  needs:
-   - job: make-image-fed35
- image: $CI_REGISTRY_IMAGE/fedora35:branch-$CI_COMMIT_REF_SLUG
+   - job: make-image-fed37
+ image: $CI_REGISTRY_IMAGE/fedora37:branch-$CI_COMMIT_REF_SLUG
 
 
 ## Jobs to publish commits + tags from master to github
@@ -125,8 +113,7 @@
   needs:
    - job: build-deb
    - job: build-fed36
-   - job: build-fed34
-   - job: build-fed35
+   - job: build-fed37
   when: manual
   variables:
     RELEASE_SYNC_PUBLIC_URL: g...@github.com:ProtonVPN/protonvpn-nm-lib.git
@@ -139,8 +126,7 @@
   needs:
    - job: build-deb
    - job: build-fed36
-   - job: build-fed34
-   - job: build-fed35
+   - job: build-fed37
   when: manual
   variables:
     RELEASE_SYNC_PUBLIC_URL: g...@github.com:ProtonVPN/protonvpn-nm-lib.git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/protonvpn-nm-lib-3.11.0/Dockerfile.fed34 
new/protonvpn-nm-lib-3.14.0/Dockerfile.fed34
--- old/protonvpn-nm-lib-3.11.0/Dockerfile.fed34        2022-05-31 
16:19:23.000000000 +0200
+++ new/protonvpn-nm-lib-3.14.0/Dockerfile.fed34        1970-01-01 
01:00:00.000000000 +0100
@@ -1,74 +0,0 @@
-FROM IMAGE_URL_FED34
-ARG git_repo
-ENV git_repo=${git_repo:-GIT_REPO}
-ARG git_branch
-ENV git_branch=${git_branch:-GIT_BRANCH}
-
-RUN dnf update -y
-
-# Install a few useful packages
-
-RUN dnf install -y net-tools \
-    gcc \
-    sudo \
-    git \
-    rpm-build \
-    rpm-devel \
-    rpmlint \
-    rpmdevtools \
-    rpm-sign \
-    python3 \
-    python3-pip \
-    NetworkManager \
-    NetworkManager-openvpn \
-    sudo \
-    vim \
-    nano \
-    pkg-config \
-    openvpn \
-    openssl-devel \
-    openssl-libs \
-    dbus-x11 \
-    gnome-keyring \
-    libsecret \
-    gtk3 \
-    polkit
-
-RUN dnf install -y \
-    python3-pyxdg \
-    python3-dbus \
-    python3-keyring \
-    python3-distro \
-    python3-gobject \
-    python3-jinja2 \
-    python3-systemd
-
-RUN dnf install -y \
-    python3-pytest \
-    python3-pytest-cov
-
-RUN dnf install -y \
-    python3-requests \
-    python3-pyOpenSSL \
-    python3-bcrypt \
-    python3-gnupg
-
-RUN python3 -m pip install --upgrade sentry-sdk==0.10.2
-
-RUN git clone --single-branch --branch $git_branch $git_repo
-RUN cd proton-python-client && pip3 install -e .
-RUN cd ..
-
-RUN useradd -ms /bin/bash user
-RUN usermod -a -G wheel user
-RUN echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
-
-COPY docker_entry_rpm.sh /usr/local/bin
-COPY . /home/user/protonvpn-nm-lib
-
-RUN chown -R user:user /home/user/protonvpn-nm-lib
-WORKDIR /home/user/protonvpn-nm-lib
-
-USER user
-
-ENTRYPOINT ["/usr/local/bin/docker_entry_rpm.sh"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/protonvpn-nm-lib-3.11.0/Dockerfile.fed35 
new/protonvpn-nm-lib-3.14.0/Dockerfile.fed35
--- old/protonvpn-nm-lib-3.11.0/Dockerfile.fed35        2022-05-31 
16:19:23.000000000 +0200
+++ new/protonvpn-nm-lib-3.14.0/Dockerfile.fed35        1970-01-01 
01:00:00.000000000 +0100
@@ -1,74 +0,0 @@
-FROM IMAGE_URL_FED35
-ARG git_repo
-ENV git_repo=${git_repo:-GIT_REPO}
-ARG git_branch
-ENV git_branch=${git_branch:-GIT_BRANCH}
-
-RUN dnf update -y
-
-# Install a few useful packages
-
-RUN dnf install -y net-tools \
-    gcc \
-    sudo \
-    git \
-    rpm-build \
-    rpm-devel \
-    rpmlint \
-    rpmdevtools \
-    rpm-sign \
-    python3 \
-    python3-pip \
-    NetworkManager \
-    NetworkManager-openvpn \
-    sudo \
-    vim \
-    nano \
-    pkg-config \
-    openvpn \
-    openssl-devel \
-    openssl-libs \
-    dbus-x11 \
-    gnome-keyring \
-    libsecret \
-    gtk3 \
-    polkit
-
-RUN dnf install -y \
-    python3-pyxdg \
-    python3-dbus \
-    python3-keyring \
-    python3-distro \
-    python3-gobject \
-    python3-jinja2 \
-    python3-systemd
-
-RUN dnf install -y \
-    python3-pytest \
-    python3-pytest-cov
-
-RUN dnf install -y \
-    python3-requests \
-    python3-pyOpenSSL \
-    python3-bcrypt \
-    python3-gnupg
-
-RUN python3 -m pip install --upgrade sentry-sdk==0.10.2
-
-RUN git clone --single-branch --branch $git_branch $git_repo
-RUN cd proton-python-client && pip3 install -e .
-RUN cd ..
-
-RUN useradd -ms /bin/bash user
-RUN usermod -a -G wheel user
-RUN echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
-
-COPY docker_entry_rpm.sh /usr/local/bin
-COPY . /home/user/protonvpn-nm-lib
-
-RUN chown -R user:user /home/user/protonvpn-nm-lib
-WORKDIR /home/user/protonvpn-nm-lib
-
-USER user
-
-ENTRYPOINT ["/usr/local/bin/docker_entry_rpm.sh"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/protonvpn-nm-lib-3.11.0/Dockerfile.fed37 
new/protonvpn-nm-lib-3.14.0/Dockerfile.fed37
--- old/protonvpn-nm-lib-3.11.0/Dockerfile.fed37        1970-01-01 
01:00:00.000000000 +0100
+++ new/protonvpn-nm-lib-3.14.0/Dockerfile.fed37        2022-10-20 
17:13:58.000000000 +0200
@@ -0,0 +1,74 @@
+FROM IMAGE_URL_FED37
+ARG git_repo
+ENV git_repo=${git_repo:-GIT_REPO}
+ARG git_branch
+ENV git_branch=${git_branch:-GIT_BRANCH}
+
+RUN dnf update -y
+
+# Install a few useful packages
+
+RUN dnf install -y net-tools \
+    gcc \
+    sudo \
+    git \
+    rpm-build \
+    rpm-devel \
+    rpmlint \
+    rpmdevtools \
+    rpm-sign \
+    python3 \
+    python3-pip \
+    NetworkManager \
+    NetworkManager-openvpn \
+    sudo \
+    vim \
+    nano \
+    pkg-config \
+    openvpn \
+    openssl-devel \
+    openssl-libs \
+    dbus-x11 \
+    gnome-keyring \
+    libsecret \
+    gtk3 \
+    polkit
+
+RUN dnf install -y \
+    python3-pyxdg \
+    python3-dbus \
+    python3-keyring \
+    python3-distro \
+    python3-gobject \
+    python3-jinja2 \
+    python3-systemd
+
+RUN dnf install -y \
+    python3-pytest \
+    python3-pytest-cov
+
+RUN dnf install -y \
+    python3-requests \
+    python3-pyOpenSSL \
+    python3-bcrypt \
+    python3-gnupg
+
+RUN python3 -m pip install --upgrade sentry-sdk==0.10.2
+
+RUN git clone --single-branch --branch $git_branch $git_repo
+RUN cd proton-python-client && pip3 install -e .
+RUN cd ..
+
+RUN useradd -ms /bin/bash user
+RUN usermod -a -G wheel user
+RUN echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
+
+COPY docker_entry_rpm.sh /usr/local/bin
+COPY . /home/user/protonvpn-nm-lib
+
+RUN chown -R user:user /home/user/protonvpn-nm-lib
+WORKDIR /home/user/protonvpn-nm-lib
+
+USER user
+
+ENTRYPOINT ["/usr/local/bin/docker_entry_rpm.sh"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/protonvpn-nm-lib-3.11.0/Makefile 
new/protonvpn-nm-lib-3.14.0/Makefile
--- old/protonvpn-nm-lib-3.11.0/Makefile        2022-05-31 16:19:23.000000000 
+0200
+++ new/protonvpn-nm-lib-3.14.0/Makefile        2022-10-20 17:13:58.000000000 
+0200
@@ -14,12 +14,11 @@
 
 IMAGE_URL_DEB = ubuntu:latest
 IMAGE_URL_FED36 = fedora:36
-IMAGE_URL_FED34 = fedora:34
-IMAGE_URL_FED35 = fedora:35
+IMAGE_URL_FED37 = fedora:37
 IMAGE_URL_ARCH = archlinux:latest
 
 # Run make base to build both images based on ubuntu and fedora
-base: image-deb image-fed36 image-fed34 image-fed35 image-arch
+base: image-deb image-fed36 image-fed37 image-arch
 
 # Create the image based on ubuntu
 image-deb: image
@@ -32,25 +31,15 @@
 image-arch: src = archlinux
 
 
-# Create the image based on fedora 31
-image-fed31: image
-image-fed31: DOCKER_FILE_SOURCE = Dockerfile.fed31
-image-fed31: src = fedora31
-
 # Create the image based on fedora 36
 image-fed36: image
 image-fed36: DOCKER_FILE_SOURCE = Dockerfile.fed36
 image-fed36: src = fedora36
 
-# Create the image based on fedora 34
-image-fed34: image
-image-fed34: DOCKER_FILE_SOURCE = Dockerfile.fed34
-image-fed34: src = fedora34
-
-# Create the image based on fedora 35
-image-fed35: image
-image-fed35: DOCKER_FILE_SOURCE = Dockerfile.fed35
-image-fed35: src = fedora35
+# Create the image based on fedora 37
+image-fed37: image
+image-fed37: DOCKER_FILE_SOURCE = Dockerfile.fed37
+image-fed37: src = fedora37
 
 
 ## Make remote image form a branch make image branch=<branchName> (master 
default)
@@ -61,7 +50,7 @@
 
 ## We host our own copy of the image ubuntu:latest
 docker-source:
-       sed "s|IMAGE_URL_FED36|$(IMAGE_URL_FED36)|; 
s|IMAGE_URL_FED34|$(IMAGE_URL_FED34)|; s|IMAGE_URL_FED35|$(IMAGE_URL_FED35)|; 
s|IMAGE_URL_DEB|$(IMAGE_URL_DEB)|; s|IMAGE_URL_ARCH|$(IMAGE_URL_ARCH)|" 
$(DOCKER_FILE_SOURCE) > /tmp/Dockerfile.image
+       sed "s|IMAGE_URL_FED36|$(IMAGE_URL_FED36)|; 
s|IMAGE_URL_FED37|$(IMAGE_URL_FED37)|; s|IMAGE_URL_DEB|$(IMAGE_URL_DEB)|; 
s|IMAGE_URL_ARCH|$(IMAGE_URL_ARCH)|" $(DOCKER_FILE_SOURCE) > 
/tmp/Dockerfile.image
 
 requirements.txt:
        @ touch requirements.txt
@@ -78,7 +67,7 @@
        @ rm -rf __SOURCE_APP || true
 local: NAME_IMAGE = protonvpn-nm-lib:latest
 
-local-base: local-deb local-fed36 local-fed34 local-fed35 local-arch
+local-base: local-deb local-fed36 local-fed37 local-arch
 
 local-deb: local
 local-deb: DOCKER_FILE_SOURCE = Dockerfile.deb
@@ -86,11 +75,8 @@
 local-fed36: local
 local-fed36: DOCKER_FILE_SOURCE = Dockerfile.fed36
 
-local-fed34: local
-local-fed34: DOCKER_FILE_SOURCE = Dockerfile.fed34
-
-local-fed35: local
-local-fed35: DOCKER_FILE_SOURCE = Dockerfile.fed35
+local-fed37: local
+local-fed37: DOCKER_FILE_SOURCE = Dockerfile.fed37
 
 local-arch: local
 local-arch: DOCKER_FILE_SOURCE = Dockerfile.arch
@@ -125,18 +111,8 @@
                        --volume 
$(PWD)/.env:/home/user/proton-python-client.env \
                        proton-python-client:latest \
                        python3 -m pytest
-                       
-test-fed34: local-fed34
-       # Keep -it because with colors it's better
-       @ docker run \
-                       --rm \
-                       -it \
-                       --privileged \
-                       --volume 
$(PWD)/.env:/home/user/proton-python-client.env \
-                       proton-python-client:latest \
-                       python3 -m pytest
 
-test-fed35: local-fed35
+test-fed37: local-fed37
        # Keep -it because with colors it's better
        @ docker run \
                        --rm \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/protonvpn-nm-lib-3.11.0/arch/PKGBUILD 
new/protonvpn-nm-lib-3.14.0/arch/PKGBUILD
--- old/protonvpn-nm-lib-3.11.0/arch/PKGBUILD   2022-05-31 16:19:23.000000000 
+0200
+++ new/protonvpn-nm-lib-3.14.0/arch/PKGBUILD   2022-10-20 17:13:58.000000000 
+0200
@@ -1,7 +1,7 @@
 # Maintainer: Proton Technologies AG <opensou...@proton.me>
 pkgname=python-protonvpn-nm-lib
-pkgver=3.11.0
-pkgrel=2
+pkgver=3.12.0
+pkgrel=1
 pkgdesc="Official Proton VPN NetworkManager library."
 arch=("any")
 url="https://github.com/ProtonVPN";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/protonvpn-nm-lib-3.11.0/debian/changelog 
new/protonvpn-nm-lib-3.14.0/debian/changelog
--- old/protonvpn-nm-lib-3.11.0/debian/changelog        2022-05-31 
16:19:23.000000000 +0200
+++ new/protonvpn-nm-lib-3.14.0/debian/changelog        2022-10-20 
17:13:58.000000000 +0200
@@ -1,3 +1,21 @@
+protonvpn-nm-lib (3.14.0-1) unstable; urgency=medium
+
+  * Fix: When vpn session is invalid and an api request is made, ensure that 
user is logged out
+
+ -- Proton Technologies AG <opensou...@proton.me>  Tue, 18 Oct 2022 16:00:00 
+0000
+
+protonvpn-nm-lib (3.13.0-1) unstable; urgency=medium
+
+  * Fix: Properly handle session refresh
+
+ -- Proton Technologies AG <opensou...@proton.me>  Wed, 31 Aug 2022 16:00:00 
+0000
+ 
+protonvpn-nm-lib (3.12.0-1) unstable; urgency=medium
+
+  * Fix: Display propper error message when unable to establish VPN tunnel
+
+ -- Proton Technologies AG <opensou...@proton.me>  Fri, 29 Jul 2022 16:00:00 
+0000
+
 protonvpn-nm-lib (3.11.0-2) unstable; urgency=medium
 
   * Fix: When loading a session from keyring, update the app version and user 
agent with the current ones
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/protonvpn-nm-lib-3.11.0/protonvpn_nm_lib/constants.py 
new/protonvpn-nm-lib-3.14.0/protonvpn_nm_lib/constants.py
--- old/protonvpn-nm-lib-3.11.0/protonvpn_nm_lib/constants.py   2022-05-31 
16:19:23.000000000 +0200
+++ new/protonvpn-nm-lib-3.14.0/protonvpn_nm_lib/constants.py   2022-10-20 
17:13:58.000000000 +0200
@@ -13,7 +13,7 @@
                     SecureCoreStatusEnum, UserSettingConnectionEnum,
                     UserSettingStatusEnum)
 
-APP_VERSION = "3.11.0"
+APP_VERSION = "3.14.0"
 API_URL = "https://api.protonvpn.ch";
 
 IPv6_LEAK_PROTECTION_CONN_NAME = "pvpn-ipv6leak-protection"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/protonvpn-nm-lib-3.11.0/protonvpn_nm_lib/core/accounting/default_accounting.py
 
new/protonvpn-nm-lib-3.14.0/protonvpn_nm_lib/core/accounting/default_accounting.py
--- 
old/protonvpn-nm-lib-3.11.0/protonvpn_nm_lib/core/accounting/default_accounting.py
  2022-05-31 16:19:23.000000000 +0200
+++ 
new/protonvpn-nm-lib-3.14.0/protonvpn_nm_lib/core/accounting/default_accounting.py
  2022-10-20 17:13:58.000000000 +0200
@@ -66,4 +66,4 @@
         except: # noqa
             current_sessions = self._env.api_session.max_connections
 
-        return current_sessions >= self._env.api_session.max_connections
+        return current_sessions > self._env.api_session.max_connections
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/protonvpn-nm-lib-3.11.0/protonvpn_nm_lib/core/notification/notifications.py 
new/protonvpn-nm-lib-3.14.0/protonvpn_nm_lib/core/notification/notifications.py
--- 
old/protonvpn-nm-lib-3.11.0/protonvpn_nm_lib/core/notification/notifications.py 
    2022-05-31 16:19:23.000000000 +0200
+++ 
new/protonvpn-nm-lib-3.14.0/protonvpn_nm_lib/core/notification/notifications.py 
    2022-10-20 17:13:58.000000000 +0200
@@ -44,11 +44,12 @@
         )
 
     def get_all_notifications(self):
-        try:
-            _data = self.__data.get("Notifications", None)[0]
-        except (IndexError, AttributeError) as e:
-            logger.exception(e)
+        notifications = self.__data.get("Notifications", None)
+        if len(notifications) < 1:
+            logger.info("Nofitications are empty: {}".format(notifications))
             _data = {}
+        else:
+            _data = notifications[0]
 
         return BaseNotificationType.factory(_data)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/protonvpn-nm-lib-3.11.0/protonvpn_nm_lib/core/session/session.py 
new/protonvpn-nm-lib-3.14.0/protonvpn_nm_lib/core/session/session.py
--- old/protonvpn-nm-lib-3.11.0/protonvpn_nm_lib/core/session/session.py        
2022-05-31 16:19:23.000000000 +0200
+++ new/protonvpn-nm-lib-3.14.0/protonvpn_nm_lib/core/session/session.py        
2022-10-20 17:13:58.000000000 +0200
@@ -91,14 +91,13 @@
 
     # Common handlers retries
     def _handle_429(self, error, session, *args, **kwargs):
-        logger.info("Catched 429 error, will retry")
+        logger.info("Catched 429 error, retrying new request if retry header 
present")
 
-        hold_request_time = error.headers["Retry-After"]
+        hold_request_time = error.headers.get("Retry-After")
         try:
             hold_request_time = int(hold_request_time)
         except ValueError:
-            # Wait at least two seconds, and up to 20
-            hold_request_time = 2 + random.random() * 18
+            raise UnreacheableAPIError(error)
 
         logger.info("Retrying after {} seconds".format(hold_request_time))
         time.sleep(hold_request_time)
@@ -106,12 +105,24 @@
         # Retry
         return self._call_original_function(session, *args, **kwargs)
 
+    def _handle_500(self, error, session, *args, **kwargs):
+        logger.info("Catched 500 error, raising exception")
+
+        raise UnreacheableAPIError(error)
+
     def _handle_503(self, error, session, *args, **kwargs):
-        logger.info("Catched 503 error, retrying new request")
+        logger.info("Catched 503 error, retrying new request if retry header 
present")
+
+        hold_request_time = error.headers.get("Retry-After")
+        try:
+            hold_request_time = int(hold_request_time)
+        except ValueError:
+            raise UnreacheableAPIError(error)
 
-        # Wait between 2 and 10 seconds
-        hold_request_time = 2 + random.random() * 8
+        logger.info("Retrying after {} seconds".format(hold_request_time))
         time.sleep(hold_request_time)
+
+        # Retry
         return self._call_original_function(session, *args, **kwargs)
 
     def _handle_2011(self, error, session, *args, **kwargs):
@@ -145,17 +156,29 @@
         return self._call_without_error_handling(session, *args, **kwargs)
 
     def _handle_403(self, error, session, *args, **kwargs):
+        logger.info("Catched 403 error, missing scopes. Re-authentication 
needed.")
         raise API403Error(error)
 
     def _handle_5002(self, error, session, *args, **kwargs):
+        logger.info("Catched 5002 error, invalid version.")
         raise API5002Error(error)
 
     def _handle_5003(self, error, session, *args, **kwargs):
+        logger.info("Catched 5003 error, bad version.")
         raise API5003Error(error)
 
     def _handle_10013(self, error, session, *args, **kwargs):
+        logger.info("Catched 10013 error, session invalid.")
         raise API10013Error(error)
 
+    def _handle_400(self, error, session, *args, **kwargs):
+        logger.info("Catched 400 error, session invalid.")
+        raise APISessionIsNotValidError(error)
+
+    def _handle_422(self, error, session, *args, **kwargs):
+        logger.info("Catched 422 error, session invalid.")
+        raise APISessionIsNotValidError(error)
+
 
 class ErrorStrategyAuthenticate(ErrorStrategy):
     def _handle_401(self, error, session, *args, **kwargs):
@@ -163,15 +186,33 @@
         pass
 
     def _handle_403(self, error, session, *args, **kwargs):
-        logger.info("Ignored a 401 at authenticate")
+        logger.info("Ignored a 403 at authenticate")
         pass
 
     def _handle_8002(self, error, session, *args, **kwargs):
+        logger.info("Catched 8002, incorrect credentials.")
         raise API8002Error(error)
 
 
 class ErrorStrategyRefresh(ErrorStrategy):
-    pass
+    def _handle_409(self, error, session, *args, **kwargs):
+        logger.info(
+            "Catched 409 error, possible race condition,"
+            "retry with error handling."
+        )
+        return self._call_without_error_handling(session, *args, **kwargs)
+
+    def _handle_10013(self, error, session, *args, **kwargs):
+        logger.info("Catched 10013 error, session invalid.")
+        raise APISessionIsNotValidError(error)
+
+    def _handle_400(self, error, session, *args, **kwargs):
+        logger.info("Catched 400 error, session invalid.")
+        raise APISessionIsNotValidError(error)
+
+    def _handle_422(self, error, session, *args, **kwargs):
+        logger.info("Catched 422 error, session invalid.")
+        raise APISessionIsNotValidError(error)
 
 
 class APISession:
@@ -193,13 +234,12 @@
 
     """
 
-    # Probably would be better to have that somewhere else
-    FULL_CACHE_TIME_EXPIRE = 3 * (60 * 60)  # 3h in seconds
-    STREAMING_SERVICES_TIME_EXPIRE = FULL_CACHE_TIME_EXPIRE
-    CLIENT_CONFIG_TIME_EXPIRE = FULL_CACHE_TIME_EXPIRE
-    STREAMING_ICON_TIME_EXPIRE = 8 * (60 * 60)  # 8h in seconds
-    NOTIFICATIONS_TIME_EXPIRE = 12 * (60 * 60)   # 12h in seconds
-    LOADS_CACHE_TIME_EXPIRE = 15 * 60  # 15min in seconds
+    FULL_CACHE_TIME_EXPIRE = 10800  # 3h in seconds
+    STREAMING_SERVICES_TIME_EXPIRE = 10800
+    CLIENT_CONFIG_TIME_EXPIRE = 10800
+    STREAMING_ICON_TIME_EXPIRE = 28800  # 8h in seconds
+    NOTIFICATIONS_TIME_EXPIRE = 43200   # 12h in seconds
+    LOADS_CACHE_TIME_EXPIRE = 900  # 15min in seconds
     RANDOM_FRACTION = 0.22  # Generate a value of the timeout, +/- up to 22%, 
at random
     TIMEOUT = (3.05, 3.05)
 
@@ -633,6 +673,8 @@
 
         try:
             self.update_servers_if_needed()
+        except APISessionIsNotValidError:
+            raise
         except: # noqa
             pass
 
@@ -798,6 +840,8 @@
 
         try:
             self._update_notifications_if_needed()
+        except APISessionIsNotValidError:
+            raise
         except: # noqa
             pass
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/protonvpn-nm-lib-3.11.0/protonvpn_nm_lib/exceptions.py 
new/protonvpn-nm-lib-3.14.0/protonvpn_nm_lib/exceptions.py
--- old/protonvpn-nm-lib-3.11.0/protonvpn_nm_lib/exceptions.py  2022-05-31 
16:19:23.000000000 +0200
+++ new/protonvpn-nm-lib-3.14.0/protonvpn_nm_lib/exceptions.py  2022-10-20 
17:13:58.000000000 +0200
@@ -110,6 +110,14 @@
     """Proton session wrapper error."""
 
 
+class API400Error(ProtonSessionWrapperError):
+    """Error 400.
+
+    Upon refreshing tokens, wwhen a request is badly formatted this exception
+    is raised. Usually requires a user to re-login.
+    """
+
+
 class API401Error(ProtonSessionWrapperError):
     """Error 401.
 
@@ -124,6 +132,14 @@
     """
 
 
+class API422Error(ProtonSessionWrapperError):
+    """Error 422.
+
+    Upon refreshing tokens, this exception is raised
+    session has experied and re-login is required.
+    """
+
+
 class API429Error(ProtonSessionWrapperError):
     """Error 429.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/protonvpn-nm-lib-3.11.0/rpmbuild/SPECS/python3-protonvpn-nm-lib.spec 
new/protonvpn-nm-lib-3.14.0/rpmbuild/SPECS/python3-protonvpn-nm-lib.spec
--- old/protonvpn-nm-lib-3.11.0/rpmbuild/SPECS/python3-protonvpn-nm-lib.spec    
2022-05-31 16:19:23.000000000 +0200
+++ new/protonvpn-nm-lib-3.14.0/rpmbuild/SPECS/python3-protonvpn-nm-lib.spec    
2022-10-20 17:13:58.000000000 +0200
@@ -1,6 +1,6 @@
 %define unmangled_name protonvpn-nm-lib
-%define version 3.11.0
-%define release 2
+%define version 3.14.0
+%define release 1
 
 Prefix: %{_prefix}
 
@@ -60,6 +60,18 @@
 %defattr(-,root,root)
 
 %changelog
+* Tue Oct 18 2022 Proton Technologies AG <opensou...@proton.me> 3.14.0-1
+- Fix: When vpn session is invalid, ensure that user is logged out
+
+* Thu Sep 22 2022 Proton Technologies AG <opensou...@proton.me> 3.13.0-2
+- Drop F34-35 and add F37
+
+* Fri Aug 31 2022 Proton Technologies AG <opensou...@proton.me> 3.13.0-1
+- Fix: Properly handle session refresh
+
+* Fri Jul 29 2022 Proton Technologies AG <opensou...@proton.me> 3.12.0-1
+- Fix: Display propper error message when unable to establish VPN tunnel
+
 * Tue May 31 2022 Proton Technologies AG <opensou...@proton.me> 3.11.0-2
 - Fix: When loading a session from keyring, update the app version and user 
agent with the current ones
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/protonvpn-nm-lib-3.11.0/tests/test_default_accounting.py 
new/protonvpn-nm-lib-3.14.0/tests/test_default_accounting.py
--- old/protonvpn-nm-lib-3.11.0/tests/test_default_accounting.py        
2022-05-31 16:19:23.000000000 +0200
+++ new/protonvpn-nm-lib-3.14.0/tests/test_default_accounting.py        
2022-10-20 17:13:58.000000000 +0200
@@ -92,7 +92,7 @@
         super().__init__()
 
     def get_sessions(self):
-        return ["MockSession1", "MockSession2"]
+        return ["MockSession1", "MockSession2", "MockSession3"]
 
 
 class TestDefaultAccounting:

Reply via email to