gmailsorter 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/PKG-INFO +6 -6
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/pyproject.toml +5 -5
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/_version.py +2 -2
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/app.py +3 -1
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/googleapi.py +21 -2
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/.gitignore +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/LICENSE +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/README.md +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/__init__.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/__main__.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/daemon/__init__.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/daemon/__main__.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/daemon/daemon.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/daemon/shared.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/daemon/tasks.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/google/__init__.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/google/authentication.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/google/database.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/google/mail.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/google/message.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/local.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/__init__.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/__main__.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/config.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/database.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/render.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/css/main.css +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/css/util.css +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-Black.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-BlackItalic.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-Bold.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-BoldItalic.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-ExtraBold.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-ExtraBoldItalic.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-ExtraLight.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-ExtraLightItalic.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-Italic.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-Light.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-LightItalic.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-Medium.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-MediumItalic.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-Regular.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-SemiBold.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-SemiBoldItalic.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-Thin.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-ThinItalic.ttf +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/images/bg-01.jpg +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/images/icons/favicon.ico +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/templates/login.html +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/templates/user.html +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/user.py +0 -0
- {gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/wsgi.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: gmailsorter
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Assign labels to emails in Google Mail based on their similarity to other emails assigned to the same label.
|
|
5
5
|
Project-URL: Homepage, https://github.com/jan-janssen/gmailsorter
|
|
6
6
|
Author-email: Jan Janssen <jan.janssen@outlook.com>
|
|
@@ -15,11 +15,11 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.14
|
|
17
17
|
Requires-Python: >=3.10
|
|
18
|
-
Requires-Dist: google-api-python-client>=2.
|
|
18
|
+
Requires-Dist: google-api-python-client>=2.202.0
|
|
19
19
|
Requires-Dist: google-auth-oauthlib>=1.5.0
|
|
20
|
-
Requires-Dist: google-auth>=2.
|
|
21
|
-
Requires-Dist: mailsort>=0.0.
|
|
22
|
-
Requires-Dist: sqlalchemy>=2.
|
|
20
|
+
Requires-Dist: google-auth>=2.63.0
|
|
21
|
+
Requires-Dist: mailsort>=0.0.6
|
|
22
|
+
Requires-Dist: sqlalchemy>=2.1.9
|
|
23
23
|
Provides-Extra: docs
|
|
24
24
|
Requires-Dist: myst-parser; extra == 'docs'
|
|
25
25
|
Requires-Dist: nbsphinx; extra == 'docs'
|
|
@@ -27,7 +27,7 @@ Requires-Dist: sphinx; extra == 'docs'
|
|
|
27
27
|
Provides-Extra: webapp
|
|
28
28
|
Requires-Dist: flask-login>=0.6.3; extra == 'webapp'
|
|
29
29
|
Requires-Dist: flask>=3.1.3; extra == 'webapp'
|
|
30
|
-
Requires-Dist: gunicorn>=
|
|
30
|
+
Requires-Dist: gunicorn>=27.0.1; extra == 'webapp'
|
|
31
31
|
Description-Content-Type: text/markdown
|
|
32
32
|
|
|
33
33
|
# Gmailsorter - Similarity based email sorting for Google Mail
|
|
@@ -23,16 +23,16 @@ classifiers = [
|
|
|
23
23
|
"Programming Language :: Python :: 3.14",
|
|
24
24
|
]
|
|
25
25
|
dependencies = [
|
|
26
|
-
"google-api-python-client>=2.
|
|
27
|
-
"google-auth>=2.
|
|
26
|
+
"google-api-python-client>=2.202.0",
|
|
27
|
+
"google-auth>=2.63.0",
|
|
28
28
|
"google-auth-oauthlib>=1.5.0",
|
|
29
|
-
"mailsort>=0.0.
|
|
30
|
-
"sqlalchemy>=2.
|
|
29
|
+
"mailsort>=0.0.6",
|
|
30
|
+
"sqlalchemy>=2.1.9",
|
|
31
31
|
]
|
|
32
32
|
|
|
33
33
|
[project.optional-dependencies]
|
|
34
34
|
webapp = [
|
|
35
|
-
"gunicorn>=
|
|
35
|
+
"gunicorn>=27.0.1",
|
|
36
36
|
"flask>=3.1.3",
|
|
37
37
|
"flask-login>=0.6.3",
|
|
38
38
|
]
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.2.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 2,
|
|
21
|
+
__version__ = version = '0.2.2'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 2, 2)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -155,7 +155,7 @@ def oauth2callback() -> flask.Response | tuple[str, int]:
|
|
|
155
155
|
# session (stale link, reload, crawler or blocked cookies).
|
|
156
156
|
return flask.redirect(flask.url_for("index"))
|
|
157
157
|
|
|
158
|
-
credentials_dict = get_google_credentials(
|
|
158
|
+
credentials_dict, error_scopes = get_google_credentials(
|
|
159
159
|
client_config=CLIENT_SECRETS_CONFIG,
|
|
160
160
|
scopes=SCOPES,
|
|
161
161
|
state=state,
|
|
@@ -163,6 +163,8 @@ def oauth2callback() -> flask.Response | tuple[str, int]:
|
|
|
163
163
|
authorization_response=flask.request.url,
|
|
164
164
|
code_verifier=code_verifier,
|
|
165
165
|
)
|
|
166
|
+
if error_scopes is not None:
|
|
167
|
+
return error_scopes, 403
|
|
166
168
|
|
|
167
169
|
flask.session["credentials"] = credentials_dict
|
|
168
170
|
user_info_dict, error_user, _ = get_user_info(
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# Based on https://developers.google.com/identity/protocols/oauth2/web-server#python
|
|
2
|
+
import os
|
|
2
3
|
from datetime import datetime
|
|
3
4
|
from typing import Any
|
|
4
5
|
|
|
@@ -7,8 +8,15 @@ import google_auth_oauthlib.flow
|
|
|
7
8
|
import googleapiclient.discovery
|
|
8
9
|
from google.auth.exceptions import RefreshError
|
|
9
10
|
from googleapiclient.errors import HttpError
|
|
11
|
+
from oauthlib.oauth2.rfc6749.utils import scope_to_list
|
|
10
12
|
from sqlalchemy import Engine
|
|
11
13
|
|
|
14
|
+
# Google's granular consent screen lets users deselect individual scopes, and
|
|
15
|
+
# include_granted_scopes can add previously granted ones. In both cases the
|
|
16
|
+
# granted scopes differ from the requested ones and oauthlib raises a Warning
|
|
17
|
+
# unless relaxed. The granted scopes are validated in get_google_credentials().
|
|
18
|
+
os.environ["OAUTHLIB_RELAX_TOKEN_SCOPE"] = "1"
|
|
19
|
+
|
|
12
20
|
from gmailsorter.daemon import (
|
|
13
21
|
GoogleMail,
|
|
14
22
|
create_tasks_for_new_users,
|
|
@@ -47,7 +55,7 @@ def get_google_credentials(
|
|
|
47
55
|
code_verifier: str,
|
|
48
56
|
redirect_uri: str,
|
|
49
57
|
authorization_response: str,
|
|
50
|
-
) -> dict[str, Any]:
|
|
58
|
+
) -> tuple[dict[str, Any] | None, str | None]:
|
|
51
59
|
# Create flow instance to manage the OAuth 2.0 Authorization Grant Flow steps.
|
|
52
60
|
flow = google_auth_oauthlib.flow.Flow.from_client_config(
|
|
53
61
|
client_config=client_config, scopes=scopes, state=state
|
|
@@ -58,10 +66,21 @@ def get_google_credentials(
|
|
|
58
66
|
# Use the authorization server's response to fetch the OAuth 2.0 tokens.
|
|
59
67
|
flow.fetch_token(authorization_response=authorization_response)
|
|
60
68
|
|
|
69
|
+
# The user may have deselected some of the requested scopes on the consent
|
|
70
|
+
# screen, see https://github.com/jan-janssen/gmailsorter/issues/516
|
|
71
|
+
granted_scopes = scope_to_list(flow.oauth2session.token.get("scope")) or []
|
|
72
|
+
missing_scopes = [s for s in scopes if s not in granted_scopes]
|
|
73
|
+
if missing_scopes:
|
|
74
|
+
return None, (
|
|
75
|
+
"gmailsorter requires all requested permissions to sort your emails. "
|
|
76
|
+
"Please log in again and grant the following permissions: "
|
|
77
|
+
+ ", ".join(missing_scopes)
|
|
78
|
+
)
|
|
79
|
+
|
|
61
80
|
# Store credentials in the session.
|
|
62
81
|
# ACTION ITEM: In a production app, you likely want to save these
|
|
63
82
|
# credentials in a persistent database instead.
|
|
64
|
-
return _credentials_to_dict(credentials=flow.credentials)
|
|
83
|
+
return _credentials_to_dict(credentials=flow.credentials), None
|
|
65
84
|
|
|
66
85
|
|
|
67
86
|
def get_user_status(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-Bold.ttf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/fonts/poppins/Poppins-Thin.ttf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gmailsorter-0.2.1 → gmailsorter-0.2.2}/src/gmailsorter/webapp/static/images/icons/favicon.ico
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|