notionhelper 0.1.4__tar.gz → 0.1.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: notionhelper
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Add your description here
5
5
  Author-email: Jan du Plessis <drjanduplessis@icloud.com>
6
6
  Requires-Python: >=3.12
@@ -140,3 +140,48 @@ file_upload_id = upload_response["id"]
140
140
  page_id = "your_page_id"
141
141
  attach_response = helper.attach_file_to_page(page_id, file_upload_id)
142
142
  print(f"Successfully uploaded and attached file: {attach_response}")
143
+ ```
144
+
145
+ ### Simplified File Operations
146
+
147
+ NotionHelper provides convenient one-step methods that combine file upload and attachment operations:
148
+
149
+ #### one_step_image_embed()
150
+ Uploads an image and embeds it in a Notion page in a single call, combining what would normally require:
151
+ 1. Uploading the file
152
+ 2. Embedding it in the page
153
+
154
+ ```python
155
+ page_id = "your_page_id"
156
+ image_path = "path/to/image.png"
157
+ response = helper.one_step_image_embed(page_id, image_path)
158
+ print(f"Successfully embedded image: {response}")
159
+ ```
160
+
161
+ #### one_step_file_to_page()
162
+ Uploads a file and attaches it to a Notion page in one step, combining:
163
+ 1. Uploading the file
164
+ 2. Attaching it to the page
165
+
166
+ ```python
167
+ page_id = "your_page_id"
168
+ file_path = "path/to/document.pdf"
169
+ response = helper.one_step_file_to_page(page_id, file_path)
170
+ print(f"Successfully attached file: {response}")
171
+ ```
172
+
173
+ #### one_step_file_to_page_property()
174
+ Uploads a file and attaches it to a specific Files & Media property on a page, combining:
175
+ 1. Uploading the file
176
+ 2. Attaching it to the page property
177
+
178
+ ```python
179
+ page_id = "your_page_id"
180
+ property_name = "Files" # Name of your Files & Media property
181
+ file_path = "path/to/document.pdf"
182
+ file_name = "Custom Display Name.pdf" # Optional display name
183
+ response = helper.one_step_file_to_page_property(page_id, property_name, file_path, file_name)
184
+ print(f"Successfully attached file to property: {response}")
185
+ ```
186
+
187
+ These methods handle all the intermediate steps automatically, making file operations with Notion much simpler.
@@ -128,3 +128,48 @@ file_upload_id = upload_response["id"]
128
128
  page_id = "your_page_id"
129
129
  attach_response = helper.attach_file_to_page(page_id, file_upload_id)
130
130
  print(f"Successfully uploaded and attached file: {attach_response}")
131
+ ```
132
+
133
+ ### Simplified File Operations
134
+
135
+ NotionHelper provides convenient one-step methods that combine file upload and attachment operations:
136
+
137
+ #### one_step_image_embed()
138
+ Uploads an image and embeds it in a Notion page in a single call, combining what would normally require:
139
+ 1. Uploading the file
140
+ 2. Embedding it in the page
141
+
142
+ ```python
143
+ page_id = "your_page_id"
144
+ image_path = "path/to/image.png"
145
+ response = helper.one_step_image_embed(page_id, image_path)
146
+ print(f"Successfully embedded image: {response}")
147
+ ```
148
+
149
+ #### one_step_file_to_page()
150
+ Uploads a file and attaches it to a Notion page in one step, combining:
151
+ 1. Uploading the file
152
+ 2. Attaching it to the page
153
+
154
+ ```python
155
+ page_id = "your_page_id"
156
+ file_path = "path/to/document.pdf"
157
+ response = helper.one_step_file_to_page(page_id, file_path)
158
+ print(f"Successfully attached file: {response}")
159
+ ```
160
+
161
+ #### one_step_file_to_page_property()
162
+ Uploads a file and attaches it to a specific Files & Media property on a page, combining:
163
+ 1. Uploading the file
164
+ 2. Attaching it to the page property
165
+
166
+ ```python
167
+ page_id = "your_page_id"
168
+ property_name = "Files" # Name of your Files & Media property
169
+ file_path = "path/to/document.pdf"
170
+ file_name = "Custom Display Name.pdf" # Optional display name
171
+ response = helper.one_step_file_to_page_property(page_id, property_name, file_path, file_name)
172
+ print(f"Successfully attached file to property: {response}")
173
+ ```
174
+
175
+ These methods handle all the intermediate steps automatically, making file operations with Notion much simpler.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "notionhelper"
3
- version = "0.1.4"
3
+ version = "0.1.6"
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -475,3 +475,60 @@ class NotionHelper:
475
475
 
476
476
  # Attach the file to the page property
477
477
  return self.attach_file_to_page_property(page_id, property_name, file_upload_id, file_name)
478
+
479
+ def info(self):
480
+ """Displays comprehensive library information in a Jupyter notebook.
481
+
482
+ Shows:
483
+ - Library name and description
484
+ - Complete list of all available methods with descriptions
485
+ - Version information
486
+ - Optional logo display (if available)
487
+
488
+ Returns:
489
+ IPython.display.HTML: An HTML display object or None if IPython is not available.
490
+ """
491
+ try:
492
+ from IPython.display import HTML
493
+ import base64
494
+ import inspect
495
+
496
+ # Get logo image data
497
+ logo_path = os.path.join(os.path.dirname(__file__), '../images/helper_logo.png')
498
+ if os.path.exists(logo_path):
499
+ with open(logo_path, "rb") as image_file:
500
+ encoded_logo = base64.b64encode(image_file.read()).decode('utf-8')
501
+ else:
502
+ encoded_logo = ""
503
+
504
+ # Get all methods and their docstrings
505
+ methods = []
506
+ for name, method in inspect.getmembers(self, predicate=inspect.ismethod):
507
+ if not name.startswith('_'):
508
+ doc = inspect.getdoc(method) or "No description available"
509
+ methods.append(f"<li><code>{name}()</code>: {doc.splitlines()[0]}</li>")
510
+
511
+ # Create HTML content
512
+ html_content = f"""
513
+ <div style="font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; max-width: 800px; margin: 0 auto; color: #1e293b;">
514
+ <h1 style="color: #1e293b;">NotionHelper Library</h1>
515
+ {f'<img src="data:image/png;base64,{encoded_logo}" style="max-width: 200px; margin: 20px 0; display: block;">' if encoded_logo else ''}
516
+ <p style="font-size: 1.1rem;">A Python helper class for interacting with the Notion API.</p>
517
+ <h3 style="color: #1e293b;">All Available Methods:</h3>
518
+ <ul style="list-style-type: none; padding-left: 0;">
519
+ {''.join(methods)}
520
+ </ul>
521
+ <h3 style="color: #1e293b;">Features:</h3>
522
+ <ul style="list-style-type: none; padding-left: 0;">
523
+ <li style="margin-bottom: 8px;">Database querying and manipulation</li>
524
+ <li style="margin-bottom: 8px;">Page creation and editing</li>
525
+ <li style="margin-bottom: 8px;">File uploads and attachments</li>
526
+ <li style="margin-bottom: 8px;">Data conversion to Pandas DataFrames</li>
527
+ </ul>
528
+ <p style="font-size: 0.9rem; color: #64748b;">Version: {getattr(self, '__version__', '1.0.0')}</p>
529
+ </div>
530
+ """
531
+ return HTML(html_content)
532
+ except ImportError:
533
+ print("IPython is required for this functionality. Please install it with: pip install ipython")
534
+ return None
@@ -163,7 +163,7 @@ wheels = [
163
163
 
164
164
  [[package]]
165
165
  name = "notionhelper"
166
- version = "0.1.3"
166
+ version = "0.1.6"
167
167
  source = { editable = "." }
168
168
  dependencies = [
169
169
  { name = "mimetype" },
File without changes