Skip to content

[Confluence] cql() attempt returning TypeError from get_endpoint() #1710

Open

Description

@fiddlefig

Hi, the cql() function was recently fixed (thank you), but after running the following code:

response = ConfluenceV2.cql(
        self = ConfluenceV2,
        cql = 'space = "mySpace" and type = page',
        limit = 25,
        expand = "content.body.stoage"
    )

for results in response.get("results", []):
        storage = results["content"]["body"]["storage"]["value"]
        print(storage)

i am getting the following error:

TypeError: get_endpoint() missing 1 required positional argument: 'endpoint_key'

Please let me know if this is user error on my part.. i do not believe it is but i could be wrong

Activity

  1. hamarshehmhmd commented on Oct 28, 2026

    @hamarshehmhmd

    This one is on the calling side, not in cql(). ConfluenceV2.cql(self=ConfluenceV2, ...) calls the method on the class and passes the class itself as self. Inside, cql() does self.get_endpoint("search"). Because self is the class, that's an unbound call, so "search" is bound to self and nothing is left for endpoint_key. That's exactly the get_endpoint() missing 1 required positional argument: 'endpoint_key' you're seeing. Even if that call worked, there'd be no URL, session or credentials to send the request with.

    Create a client first and call cql() on it:

    from atlassian import ConfluenceV2
    
    confluence = ConfluenceV2(
        url="https://your-site.atlassian.net",
        username="you@example.com",
        password="<API token>",
    )
    
    response = confluence.cql(
        'space = "mySpace" and type = page',
        limit=25,
        expand="content.body.storage",
    )
    
    for result in response.get("results", []):
        print(result["content"]["body"]["storage"]["value"])

    Two other things to check:

    • Your snippet has expand = "content.body.stoage" (missing an "r"). Confluence won't expand the body with that spelling, so ["body"]["storage"] would then raise a KeyError.
    • ConfluenceV2.cql() came in with [Confluence] ConfluenceV2: add cql() #1696 and so far only exists on master. In 5.0.5 from PyPI, hasattr(ConfluenceV2, "cql") is False. Until the next release, install from git: pip install git+https://github.com/atlassian-api/atlassian-python-api.

    I checked this against current master (785fc03) with the HTTP layer mocked via responses. Your exact call raises the same TypeError. The instance call sends GET https://your-site.atlassian.net/wiki/rest/api/search?cql=...&limit=25&expand=content.body.storage, and the loop prints the storage value from the mocked response.

  2. fiddlefig commented on Oct 28, 2026

    @fiddlefig
    Author

    @hamarshehmhmd

    • i did actually have this part set up
    confluence = ConfluenceV2(
        url="https://your-site.atlassian.net",
        username="you@example.com",
        password="<API token>",
    )
    

    i just didnt include it in my original comment.

    • fixed the typo in "storage"
    • i had already pulled the latest release.

    I checked this against current master (785fc03) with the HTTP layer mocked via responses. Your exact call raises the same TypeError. The instance call sends GET https://your-site.atlassian.net/wiki/rest/api/search?cql=...&limit=25&expand=content.body.storage, and the loop prints the storage value from the mocked response.

    Does this mean it was my own user error ? still getting the same issue after fixing the typo.

  3. hamarshehmhmd commented on Oct 28, 2026

    @hamarshehmhmd

    Not a setup problem, it's the call line. Your snippet still calls the method on the class:

    response = ConfluenceV2.cql(self=ConfluenceV2, ...)

    That ignores the confluence object you created, so it fails with the same TypeError no matter how the client is configured. Call it on your instance instead, and drop the self= argument:

    response = confluence.cql(
        'space = "mySpace" and type = page',
        limit=25,
        expand="content.body.storage",
    )

    On the release question: cql() is not in 5.0.5 from PyPI. There, ConfluenceV2.cql(...) gives AttributeError: type object 'ConfluenceCloud' has no attribute 'cql'. Since you get the TypeError instead, you are probably already on a master install. Note that a master install also reports version 5.0.5, so the version number won't tell you which one you have. If in doubt:

    pip install --force-reinstall git+https://github.com/atlassian-api/atlassian-python-api.git
    python -c "from atlassian import ConfluenceV2; print(hasattr(ConfluenceV2, 'cql'))"   # should print True
    

    I checked both versions just now. On 5.0.5 the class call gives the AttributeError. On master the class call gives your TypeError, and confluence.cql(...) sends GET /wiki/rest/api/search?cql=...&limit=25&expand=content.body.storage (HTTP mocked).

  4. fiddlefig commented on Oct 28, 2026

    @fiddlefig
    Author

    @hamarshehmhmd
    yes i said i was on the master.

    this is the error i receive after removing the self argument.

    TypeError: cql() missing 1 required positional argument: 'self'
    

    exact code i have:

    response = ConfluenceV2.cql(
            cql = 'space = "mySpace" and type = page',
            limit = 25,
            expand = "content.body.storage"
        )
    
  5. hamarshehmhmd commented on Oct 29, 2026

    @hamarshehmhmd

    cql() is an instance method, so call it on the object you created rather than on the class:

    confluence = ConfluenceV2(url=..., username=..., password=...)
    results = confluence.cql(cql=..., limit=25, expand=...)

    ConfluenceV2.cql(...) passes your arguments in place of self, which is why it fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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