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

Authentication error on second page when getting account transactions #59

Open
eprbell opened this issue Jul 2, 2024 · 1 comment
Open

Comments

@eprbell
Copy link

eprbell commented Jul 2, 2024

Thanks for this project: it's very useful. I'm running into an issue when calling client.get(f"/v2/accounts/{account_id}/transactions").

My code is fairly simple:

    def __get_transactions(self, account_id: str) -> Dict[str, Any]:
        results: List[Dict[str, Any]] = []
        cursor: Optional[str] = None
        current_uri: str = f"/v2/accounts/{account_id}/transactions"
        while True:
            current_page = self.__client.get(current_uri)
            if _DATA in current_page:
                results.extend(current_page[_DATA])
            if _PAGINATION not in current_page or _NEXT_URI not in current_page[_PAGINATION] or not current_page[_PAGINATION][_NEXT_URI]:
                break
            current_uri = current_page[_PAGINATION][_NEXT_URI]
        return results

The first page (the one with URI `f"/v2/accounts/{account_id}/transactions") is retrieved correctly, but the second one (with the next URI) is not and I'm getting:

2024-07-01 19:51:06 - coinbase.RESTClient - ERROR - HTTP Error: 401 Client Error: Unauthorized Unauthorized

The fact that the first page is retrieved correctly suggests that authentication is correct, but I'm not sure why the following pages cause this problem. Any help would be appreciated!

Copy link

github-actions bot commented Jul 2, 2024

Thank you for reporting! If this is an SDK specific issue, we will look into it and get back to you soon. If this is an API related request, report it in our Advanced API Discord instead (use this invite link if it's your first time accessing the Discord).

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

No branches or pull requests

1 participant