Skip to content

Request to Add Feature to get Create Time #30

Open
@rrayy-25809

Description

@rrayy-25809

Hello I am Korean High School Student that making Web Site using this 'notion-database' library.
While using this, I decided to use the 'create time' feature that exists in the Notion database.

Image

But I think this library didnt have feature to get 'create time' in the Notion database.
In my personal think, It might be similar with 'set_date' Attribute.

I will Share some of my code and the error message that causes the feature doesn't exist
I hopes It will help you add Features that I request.

def _dict_to_properties(self, properties_dict: dict) -> Properties:
    PROPERTY = Properties()
    for k, v in properties_dict.items():
        property_type = v['type']
        # 각 타입별로 적절히 값 추출
        if property_type == "title":
            value = v['title'][0]['text']['content'] if v['title'] else None
        elif property_type == "rich_text":
            value = v['rich_text'][0]['text']['content'] if v['rich_text'] else None
        elif property_type == "select":
            value = v['select']
        elif property_type == "date":
            value = v['date']
        elif property_type == "email":
            value = v['email']
        elif property_type == "phone_number":
            value = v['phone_number']
        elif property_type == "files":
            # 파일 리스트에서 url만 추출
            value = []
            for file_item in v['files']:
                if file_item.get('type') == 'file':
                    value.append(file_item['file']['url'])
                elif file_item.get('type') == 'external':
                    value.append(file_item['external']['url'])
        elif property_type == "checkbox":
            value = v['checkbox']
        elif property_type == 'set_created_time':
            value = v['created_time']
        else:
            value = None
        getattr(PROPERTY, f'set_{property_type}')(k, value)
    return PROPERTY
getattr(PROPERTY, f'set_{property_type}')(k, value)
AttributeError: 'Properties' object has no attribute 'set_created_time'

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions