Skip to content

Conversation

@Luis-manzur
Copy link
Contributor

fixes #1707

@Luis-manzur Luis-manzur requested a review from grossir January 5, 2026 13:48
@Luis-manzur Luis-manzur linked an issue Jan 5, 2026 that may be closed by this pull request
@Luis-manzur Luis-manzur moved this to PRs to Review in Case Law Sprint Jan 5, 2026
@flooie flooie requested review from flooie and removed request for grossir January 5, 2026 17:05
@flooie flooie assigned flooie and unassigned grossir Jan 5, 2026
Copy link
Contributor

@flooie flooie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, but lets make it a little less brittle

@Luis-manzur Luis-manzur requested a review from flooie January 5, 2026 18:40
Copy link
Contributor

@flooie flooie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have a little bit of work to do here, but overall its good to get it working

@flooie flooie assigned Luis-manzur and unassigned flooie Jan 13, 2026
@Luis-manzur
Copy link
Contributor Author

In _set_auth_headers (lines 91, 94), I still use minimal regex to extract values after XPath locates the elements:

  • re.search(r"app-container-(\d+)", ...) - extracts ID from "app-container-12754"
  • re.search(r'"tabId":(\d+)', ...) - extracts tabId from JSON,

html.xpath(self.tab_xp)[0].split("`")[-2] raise "index error"

@Luis-manzur Luis-manzur assigned flooie and unassigned Luis-manzur Jan 13, 2026
@Luis-manzur Luis-manzur requested a review from flooie January 13, 2026 18:23
days_interval = 30

# XPaths for extracting authentication values
module_xp = "//div[contains(@id, 'app-container-')]/@id"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer this

module_xp = "//div[@id='dnn_ContentPane']/div/a/@name"

and your method can be

    def _set_auth_headers(self) -> None:
        """Extract and set authentication headers from HTML page.

        :param html: Parsed HTML page (lxml element)
        :return: None
        """
        tab_script = self.html.xpath(self.tab_xp)[0]
        tab_id = re.search(r'"tabId":(\d+)', tab_script).group(1)

        self.request["headers"].update(
            {
                "ModuleId": self.html.xpath(self.module_xp)[0],
                "TabId": tab_id,
                "RequestVerificationToken": self.html.xpath(self.token_xp)[0],
            }
        )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just do this as well in download

        self.html = super()._download()
        self._set_auth_headers()

@flooie flooie assigned Luis-manzur and unassigned flooie Jan 13, 2026
@Luis-manzur Luis-manzur assigned flooie and unassigned Luis-manzur Jan 15, 2026
@Luis-manzur Luis-manzur requested a review from flooie January 15, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: PRs to Review

Development

Successfully merging this pull request may close these issues.

arizctapp_div_1 is not working

4 participants