Git Product home page Git Product logo

Comments (5)

jamalex avatar jamalex commented on July 27, 2024

Note that the slugified name can already be accessed as a property: row.license_s. But that's not amenable to passing in the non-slugified name. But adding __getitem__ could be good too, if you would find that idiom useful! I don't see any issues with it, and it would allow use of versions of the name that can't be used as property names directly.

PR's welcome for this! (see below)

from notion-py.

jamalex avatar jamalex commented on July 27, 2024

Another note: row.get("...") is very different from row.get_property. The data structure for a page (in this case, a collection row) is something like:

In [22]: row.get()                                                                                                                                                                                                                             
Out[22]: 
{'alive': True,
 'created_by': 'f86b4884-75fd-41ba-9161-2fad359c775e',
 'created_time': 1545009470407,
 'id': 'd7f9a19a-b595-49c0-a2ae-58e7d5248a67',
 'last_edited_by': 'f86b4884-75fd-41ba-9161-2fad359c775e',
 'last_edited_time': 1557276849563,
 'parent_id': '02a32a6b-aee3-4868-b2f9-01da7ec88686',
 'parent_table': 'collection',
 'properties': {'f=DE': [['QQQ']], 'title': [['My title']], 'vFY4': [['No']]},
 'type': 'page',
 'version': 22}

The get method reads data from this top-level dict. So you can do row.get("version") to get 22. The get_property method, on the other hand, pokes inside the properties subkey, and provide a bunch of assistance with making it less painful (converting human-readable property names into the underlying 4-character "property ID", converting internal value data formats into Pythonic data, etc). So I think it would actually be best to avoid adding additional interfaces onto these data structures, since it might just compound the complexity.

from notion-py.

jamalex avatar jamalex commented on July 27, 2024

Instead, I'll go back and fix the original issue being reported here. :)

It looks as if get_all_properties didn't do full slugification, which is the source of the inconsistency. Fixing that shortly!

from notion-py.

jamalex avatar jamalex commented on July 27, 2024

Fixed in #23, which will shortly be released as 0.0.21!

from notion-py.

jamalex avatar jamalex commented on July 27, 2024

Version 0.0.21 has now been released to PyPI! Please give it a try and see how it works for you. Thanks for reporting issues!

from notion-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.