Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown when Media Link field contains a link to an mp4 (and possibly other non-image links) #41

Open
anthonycats opened this issue Apr 30, 2019 · 1 comment

Comments

@anthonycats
Copy link

Here's the traceback when trying to fetch the document in question:

Traceback (most recent call last):
  File "test.py", line 49, in <module>
    response = form.submit()
  File "/usr/local/lib/python3.7/site-packages/prismic/api.py", line 272, in submit
    request_handler=self.request_handler
  File "/usr/local/lib/python3.7/site-packages/prismic/api.py", line 350, in __init__
    self.documents = [Document(d) for d in data.get("results")]
  File "/usr/local/lib/python3.7/site-packages/prismic/api.py", line 350, in <listcomp>
    self.documents = [Document(d) for d in data.get("results")]
  File "/usr/local/lib/python3.7/site-packages/prismic/api.py", line 394, in __init__
    self.fragments[f_key] = Fragment.from_json(fragment_value)
  File "/usr/local/lib/python3.7/site-packages/prismic/fragments.py", line 52, in from_json
    return f_type(data.get("value"))
  File "/usr/local/lib/python3.7/site-packages/prismic/fragments.py", line 289, in __init__
    self.name = self.image.get("name")
AttributeError: 'NoneType' object has no attribute 'get'

Here's what the data in the field looks like:

"qwerty": {
  "type": "Link.file",
   "value": {
    "file": {
      "name": "1514560395-definitivehairydairycow.mp4",
      "kind": "document",
      "url": "https://redacted.prismic.io/redacted%2F94ff171b-ec65-4867-a0fb-1fa97f2b1bda_1514560395-definitivehairydairycow.mp4",
      "size": "129914"
    }
  }
},
@ankit-patnaik
Copy link

@anthonycats Did you find any workaround to this? Even I'm struggling with the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants