csv2notion-neo 2.2.0__tar.gz → 2.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.
Files changed (30) hide show
  1. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/CHANGELOG.md +27 -0
  2. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/PKG-INFO +3 -2
  3. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/README.md +2 -1
  4. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/cli_args.py +32 -19
  5. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/notion_convert.py +2 -2
  6. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/notion_db.py +15 -4
  7. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/utils_static.py +34 -0
  8. csv2notion_neo-2.2.2/csv2notion_neo/version.py +1 -0
  9. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/pyproject.toml +1 -1
  10. csv2notion_neo-2.2.0/csv2notion_neo/version.py +0 -1
  11. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/LICENSE +0 -0
  12. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/__init__.py +0 -0
  13. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/__main__.py +0 -0
  14. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/cli.py +0 -0
  15. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/cli_steps.py +0 -0
  16. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/local_data.py +0 -0
  17. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/notion_client.py +0 -0
  18. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/notion_convert_map.py +0 -0
  19. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/notion_db_client.py +0 -0
  20. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/notion_preparator.py +0 -0
  21. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/notion_row_upload_file.py +0 -0
  22. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/notion_type_guess.py +0 -0
  23. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/notion_uploader.py +0 -0
  24. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/utils_ai.py +0 -0
  25. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/utils_db.py +0 -0
  26. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/utils_exceptions.py +0 -0
  27. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/utils_file.py +0 -0
  28. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/utils_rand_id.py +0 -0
  29. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/utils_str.py +0 -0
  30. {csv2notion_neo-2.2.0 → csv2notion_neo-2.2.2}/csv2notion_neo/utils_threading.py +0 -0
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ### 2.2.2
4
+
5
+ **🎉 Released:**
6
+ - 21st November 2026
7
+
8
+ **🔨 Improvements:**
9
+ - Updated to latest security patches across all dependencies
10
+ - Bumped local/CI toolchain pins: pip 26.3, Poetry 2.4.3
11
+
12
+ ---
13
+
14
+ ### 2.2.1
15
+
16
+ **🎉 Released:**
17
+ - 27th July 2026
18
+
19
+ **🐞 Bug Fix:**
20
+ - `--url` validation rejected valid Notion links after Notion's migration from `notion.so` to `notion.com` / `app.notion.com`; Notion app hosts on both domains are now accepted (`notion.so`, `www.notion.so`, `app.notion.so`, `notion.com`, `www.notion.com`, `app.notion.com`) while non-app hosts (e.g. `developers.notion.com`) remain rejected
21
+
22
+ **🔨 Improvements:**
23
+ - Added shared Notion host allowlist (`notion.so`, `www.notion.so`, `app.notion.so`, `notion.com`, `www.notion.com`, `app.notion.com`) used by CLI URL validation and relation URL resolution
24
+ - Improved database/page ID extraction for migrated URL shapes such as `https://app.notion.com/p/{page-id}`, hyphenated UUIDs, and slug-suffix IDs
25
+ - Updated `--url` help text and README usage notes for dual-domain support
26
+ - Expanded comprehensive test coverage to 98 methods, including Notion URL validation and ID extraction for `.so` and `.com` links
27
+
28
+ ---
29
+
3
30
  ### 2.2.0
4
31
 
5
32
  **🎉 Released:**
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csv2notion_neo
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: Upload & Merge CSV or JSON Data with Images to Notion Database
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -202,7 +202,8 @@ general options:
202
202
  --workspace active Notion workspace name
203
203
  --token Notion integration token (create at https://www.notion.so/my-integrations)
204
204
  --url Notion database URL or page URL (required);
205
- If page URL provided, database will be created within the page
205
+ accepts notion.so / app.notion.so and notion.com / app.notion.com links;
206
+ if page URL provided, database will be created within the page
206
207
  --max-threads upload threads (default: 5)
207
208
  --log file to store program log
208
209
  --verbose output debug information
@@ -163,7 +163,8 @@ general options:
163
163
  --workspace active Notion workspace name
164
164
  --token Notion integration token (create at https://www.notion.so/my-integrations)
165
165
  --url Notion database URL or page URL (required);
166
- If page URL provided, database will be created within the page
166
+ accepts notion.so / app.notion.so and notion.com / app.notion.com links;
167
+ if page URL provided, database will be created within the page
167
168
  --max-threads upload threads (default: 5)
168
169
  --log file to store program log
169
170
  --verbose output debug information
@@ -10,9 +10,11 @@ import argparse
10
10
  from pathlib import Path
11
11
  from typing import Any, Dict, List, Sequence, Tuple, Union
12
12
 
13
+ from urllib.parse import urlparse
14
+
13
15
  from csv2notion_neo.notion_convert_map import map_icon
14
16
  from csv2notion_neo.utils_exceptions import CriticalError
15
- from csv2notion_neo.utils_static import ALLOWED_TYPES, FileType
17
+ from csv2notion_neo.utils_static import ALLOWED_TYPES, FileType, is_notion_hostname
16
18
  from csv2notion_neo.utils_str import split_str
17
19
  from csv2notion_neo.version import __version__
18
20
 
@@ -61,7 +63,8 @@ def parse_args(argv: Sequence[str]) -> argparse.Namespace:
61
63
  "--url": {
62
64
  "help": (
63
65
  "Notion database URL or page URL (required);"
64
- "\nIf page URL provided, database will be created within the page"
66
+ "\naccepts notion.so / app.notion.so and notion.com / app.notion.com links;"
67
+ "\nif page URL provided, database will be created within the page"
65
68
  ),
66
69
  "metavar": "URL",
67
70
  "required": True,
@@ -396,13 +399,16 @@ def _validate_notion_token(token: str) -> str:
396
399
  def _validate_notion_url(url: str) -> str:
397
400
  """
398
401
  Validate Notion URL format.
399
-
402
+
403
+ Accepts first-party Notion app hosts on both notion.so and notion.com
404
+ (including app.notion.com / app.notion.so after Notion's June 2026 domain migration).
405
+
400
406
  Args:
401
407
  url: The URL string to validate
402
-
408
+
403
409
  Returns:
404
410
  The validated URL string
405
-
411
+
406
412
  Raises:
407
413
  CriticalError: If URL format is invalid
408
414
  """
@@ -411,31 +417,38 @@ def _validate_notion_url(url: str) -> str:
411
417
  "Notion URL cannot be empty. "
412
418
  "Please provide a valid Notion database or page URL."
413
419
  )
414
-
415
- # Check if URL starts with http/https
416
- if not (url.startswith("http://") or url.startswith("https://")):
420
+
421
+ try:
422
+ parsed = urlparse(url)
423
+ except ValueError as e:
424
+ raise CriticalError(f"Invalid URL format: '{url}'") from e
425
+
426
+ if parsed.scheme not in {"http", "https"}:
417
427
  raise CriticalError(
418
428
  f"Invalid URL format: '{url}'\n"
419
429
  "Notion URLs must start with 'http://' or 'https://'."
420
430
  )
421
-
422
- # Check if URL contains notion.so domain
423
- if "notion.so" not in url:
431
+
432
+ if not is_notion_hostname(parsed.hostname):
424
433
  raise CriticalError(
425
434
  f"Invalid Notion URL: '{url}'\n"
426
- "Only Notion.so URLs are supported. "
427
- "Please provide a valid Notion database or page URL from notion.so domain."
435
+ "Only Notion app URLs are supported "
436
+ "(notion.so / app.notion.so or notion.com / app.notion.com).\n"
437
+ "Please provide a valid Notion database or page URL."
428
438
  )
429
-
430
- # Additional validation for URL structure
431
- if not ("/" in url and len(url.split("/")) >= 4):
439
+
440
+ # Path must include at least one segment beyond the host
441
+ # e.g. /workspace/id or /p/{page-id}
442
+ path_parts = [part for part in parsed.path.split("/") if part]
443
+ if not path_parts:
432
444
  raise CriticalError(
433
445
  f"Invalid Notion URL structure: '{url}'\n"
434
446
  "Notion URLs should have the format: "
435
- "https://www.notion.so/workspace/database-id or "
436
- "https://www.notion.so/workspace/page-id"
447
+ "https://www.notion.so/workspace/database-id, "
448
+ "https://www.notion.com/workspace/page-id, or "
449
+ "https://app.notion.com/p/page-id"
437
450
  )
438
-
451
+
439
452
  return url
440
453
 
441
454
 
@@ -31,7 +31,7 @@ from csv2notion_neo.utils_exceptions import (
31
31
  TypeConversionError,
32
32
  CriticalError,
33
33
  )
34
- from csv2notion_neo.utils_static import ConversionRules, FileType
34
+ from csv2notion_neo.utils_static import ConversionRules, FileType, is_notion_url
35
35
  from csv2notion_neo.utils_str import split_str
36
36
 
37
37
  logger = logging.getLogger(__name__)
@@ -326,7 +326,7 @@ class NotionRowConverter(object): # noqa: WPS214
326
326
 
327
327
  resolved_relations = []
328
328
  for v in col_values:
329
- if v.startswith("https://www.notion.so/"):
329
+ if is_notion_url(v):
330
330
  resolved_relation = self._resolve_relation_by_url(relation_column, v)
331
331
  else:
332
332
  resolved_relation = self._resolve_relation_by_key(relation_column, v)
@@ -858,7 +858,9 @@ def _extract_database_id_from_url(notion_url: str) -> str:
858
858
  path_parts = parsed_url.path.split('/')
859
859
 
860
860
  database_id = None
861
- # Look for ID in path (e.g., notion.so/database_id)
861
+ # Look for ID in path segments:
862
+ # - classic: notion.so/workspace/{32-char-id}
863
+ # - migrated: app.notion.com/p/{page-id} (32-char or hyphenated UUID)
862
864
  for part in path_parts:
863
865
  if len(part) == 32: # Notion IDs are 32 chars long without hyphens
864
866
  database_id = part
@@ -867,13 +869,22 @@ def _extract_database_id_from_url(notion_url: str) -> str:
867
869
  database_id = part
868
870
  break
869
871
 
870
- if not database_id:
872
+ if not database_id and path_parts:
871
873
  # Fallback for URLs like https://www.notion.so/myorg/8511b9fc522249f79b90768b832599cc?v=...
872
- # The ID is usually the last part before '?' or '/'
874
+ # or https://app.notion.com/workspace/Title-8511b9fc522249f79b90768b832599cc
875
+ # The ID is usually the last part before '?' or '/' (or a 32-char suffix of it)
873
876
  if len(path_parts[-1]) == 32 or (len(path_parts[-1]) == 36 and '-' in path_parts[-1]):
874
877
  database_id = path_parts[-1]
875
- elif len(path_parts[-2]) == 32 or (len(path_parts[-2]) == 36 and '-' in path_parts[-2]):
878
+ elif len(path_parts) >= 2 and (
879
+ len(path_parts[-2]) == 32
880
+ or (len(path_parts[-2]) == 36 and '-' in path_parts[-2])
881
+ ):
876
882
  database_id = path_parts[-2]
883
+ elif len(path_parts[-1]) > 32:
884
+ # Slug with trailing 32-char hex id: "Page-Title-<32hex>"
885
+ trailing = path_parts[-1][-32:]
886
+ if all(c in "0123456789abcdefABCDEF" for c in trailing):
887
+ database_id = trailing
877
888
 
878
889
  if not database_id:
879
890
  raise NotionError("Could not extract database ID from the provided URL.")
@@ -10,6 +10,22 @@ from argparse import Namespace
10
10
  from dataclasses import dataclass
11
11
  from pathlib import Path
12
12
  from typing import Dict, List, Optional, Union
13
+ from urllib.parse import urlparse
14
+
15
+ # Notion app hosts after the June 2026 migration from notion.so → notion.com.
16
+ # Existing notion.so links continue to work; API-generated links use app.notion.com.
17
+ # Include app.notion.so for transitional/legacy bookmarks during the migration.
18
+ # Keep this allowlist explicit so docs hosts (e.g. developers.notion.com) are rejected.
19
+ ALLOWED_NOTION_HOSTS = frozenset(
20
+ (
21
+ "notion.so",
22
+ "www.notion.so",
23
+ "app.notion.so",
24
+ "notion.com",
25
+ "www.notion.com",
26
+ "app.notion.com",
27
+ )
28
+ )
13
29
 
14
30
  # NOTE:
15
31
  # "relation" is intentionally excluded from ALLOWED_TYPES used by --column-types.
@@ -46,6 +62,24 @@ UNSETTABLE_TYPES = frozenset(("created_by", "last_edited_by", "rollup", "formula
46
62
  FileType = Union[str, Path]
47
63
 
48
64
 
65
+ def is_notion_hostname(hostname: Optional[str]) -> bool:
66
+ """Return True if hostname is a first-party Notion app host (.so or .com)."""
67
+ if not hostname:
68
+ return False
69
+ return hostname.lower().rstrip(".") in ALLOWED_NOTION_HOSTS
70
+
71
+
72
+ def is_notion_url(url: str) -> bool:
73
+ """Return True if url is an http(s) link on an allowed Notion app host."""
74
+ try:
75
+ parsed = urlparse(url)
76
+ except ValueError:
77
+ return False
78
+ if parsed.scheme not in {"http", "https"}:
79
+ return False
80
+ return is_notion_hostname(parsed.hostname)
81
+
82
+
49
83
  @dataclass
50
84
  class ConversionRules(object):
51
85
  csv_file: Path
@@ -0,0 +1 @@
1
+ __version__ = "2.2.2"
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "csv2notion_neo"
7
- version = "2.2.0"
7
+ version = "2.2.2"
8
8
  description = "Upload & Merge CSV or JSON Data with Images to Notion Database"
9
9
  authors = ["Arjun <arjunprakash027@gmail.com>"]
10
10
  readme = "README.md"
@@ -1 +0,0 @@
1
- __version__ = "2.2.0"
File without changes