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

Добавьте функцию $count пожалуйста #1

Open
Albus opened this issue Dec 15, 2020 · 0 comments
Open

Добавьте функцию $count пожалуйста #1

Albus opened this issue Dec 15, 2020 · 0 comments

Comments

@Albus
Copy link

Albus commented Dec 15, 2020

что-то типа

    def count(self, odata_filter=None) -> int:
        from odata1cw.utils import make_url_part
        from requests import get
        _url_filter = make_url_part('filter', odata_filter, str)
        url = yarl.URL(self.url)
        url = url.with_path(PurePosixPath(url.path).joinpath(r"$count").as_posix()).with_query(_url_filter.lstrip(r"&"))
        r = get(url.human_repr(), auth=self.infobase._auth, headers=self.infobase._headers)  # noqa
        if r.status_code != 200:
            raise Exception(r.text)
        return int(r.text)
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

1 participant