Coder Social home page Coder Social logo

Comments (5)

rubydog avatar rubydog commented on August 30, 2024

Hi @kfleitman06, thanks for reporting the issue.

I will take a look at it and get back to you if I have any questions.

from contentful.py.

rubydog avatar rubydog commented on August 30, 2024

Hi @kfleitman06, can you please share the code snippets to produce the results mentioned above?

Thanks

from contentful.py.

kfleitman06 avatar kfleitman06 commented on August 30, 2024

hi @rubydog, thanks for taking a look

I'm able to produce these results with the following code

import ujson

import contentful

SPACE_ID = "<REDACTED>"
ACCESS_TOKEN = "<REDACTED>"


def main():
    client = contentful.Client(
        space_id=SPACE_ID,
        access_token=ACCESS_TOKEN,
        content_type_cache=True,
        reuse_entries=True,
    )

    entries = client.entries(
        {
            "content_type": "<REDACTED>",
            "fields.pageType": "features",
            "fields.slug": "<REDACTED>",
            "include": 10,
        }
    )
    if not entries:
        raise Exception
    
    entry = entries[0]

    fields = entry.fields()
    print(ujson.dumps(fields))  # this value is returned as a FastAPI response, rather than used further within this codebase


if __name__ == '__main__':
    main()

Within fields, we have fields defined such as content (a list of entries) and hero (a single referenced entry, containing fields that also have referenced entries) . The nested referenced entries mentioned prior to doing ujson.dumps() show the full resolved value under _fields, however _fields is then lost on each after ujson.dumps(), resulting in only having the link/entry ID available for any information, under raw

We currently have a support ticket open with Contentful, if you are able to access that. I can provide the redacted args from the query we are making for this example if that is helpful

from contentful.py.

rubydog avatar rubydog commented on August 30, 2024

@kfleitman06 are you using the latest version of the library? If not, can you please update to the latest version and let me know if the problem persists?

from contentful.py.

gcampes avatar gcampes commented on August 30, 2024

Just realised you were waiting for a response here 😢

Yep we were on the latest version

I believe we ended up work arounding this by recursively accessing all referenced properties before sending the parent entry over as a response.

Would be good to not need to do this step though, any thoughts on this or anything else you need from our side to help on this one?

from contentful.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.