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

You don't have permission to access this resource when getting orders #233

Open
prodev0223 opened this issue Dec 21, 2021 · 1 comment
Open

Comments

@prodev0223
Copy link

First of all, I am really happy to use your excellent library
Currently I am working on tdameritrade project.
I am facing one issue(403 error) when trying to get the orders

Here is my code to get orders
`
# first make sure that the token is still valid.
self.token_validation()

    # grab the original headers we have stored.
    merged_headers = self.headers()

    # define the payload
    data = {"accountId": account,
            "maxResults": max_results,
            "fromEnteredTime": from_entered_time,
            "toEnteredTime": to_entered_time,
            "status": status}
    print(data)
    print(merged_headers)
    # define the endpoint
    endpoint = '/orders'

    # build the url
    url = self.api_endpoint(endpoint)

    # make the request
    #return requests.get(url=url, headers=merged_headers,  verify=True).json()
    return requests.get(url=url, headers=merged_headers, params=data, verify=True).json()

`
and this is the log printed
image

but if change the request
from
return requests.get(url=url, headers=merged_headers, params=data, verify=True).json()
to
return requests.get(url=url, headers=merged_headers, verify=True).json()
then I got success(200 response)

I tried in postman with params
it works fine
Here is screenshot
image

image

Could you please assist me?

@chotaGit
Copy link

The accountId should be a number. e.g., 'accountId': '586994136'

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

2 participants