Skip to content

Could not retrieve a JSON-LD document from the URL. #133

@sharpaper

Description

@sharpaper

For some reasons pyld is not able to fetch the context URL https://www.w3.org/ns/activitystreams. I was able to reduce the issue to the following basic example, which is not working:

import pyld
doc = {
    "@context": [ 'https://www.w3.org/ns/activitystreams' ],
    "type": "Follow" }
doc = pyld.jsonld.expand(doc)

[...]
raise JSONDecodeError("Expecting value", s, err.value) from None
[...]
Dereferencing a URL did not result in a valid JSON-LD object.
[...]
Type: jsonld.InvalidUrl
Code: loading remote context failed
Details: {'url': 'https://www.w3.org/ns/activitystreams', 'cause': JsonLdError('Could not retrieve a JSON-LD document from the URL.')}

I could not debug the issue. It looks like pyld might be retrieving the context without the correct headers, but looking at the code I do see headers = { 'Accept': ...} defined in several places.
Can you guys please help me understand if this is a bug or if I'm not using the library correctly? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions