Skip to content

Conversation

@davidastephens
Copy link

Problem

Commit 0a4989c introduced a hardcoded URL override in request_statement() that breaks API connectivity:

def request_statement(token: str, query_id: str, url: Optional[str] = None) -> StatementAccess:
    """First part of the 2-step download process."""
    url = url or REQUEST_URL
    ### AKE FIX
    url = 'https://ndcdyn.interactivebrokers.com/portal.flexweb/api/v1/flexQuery'  # ← BREAKS CONNECTIVITY
    response = submit_request(url, token, query=query_id)
    ...

This hardcoded URL causes timeout errors for users:

Request Timeout, re-sending...

Impact

  • Users cannot connect to IB FlexQuery API
  • The url parameter is completely ignored
  • Applications using this library are broken
  • Affects all users who upgraded to commit 0a4989c or later

Root Cause

The hardcoded URL https://ndcdyn.interactivebrokers.com/portal.flexweb/api/v1/flexQuery appears to be a non-standard endpoint that doesn't work for most users. The standard endpoint is:

REQUEST_URL = 'https://gdcdyn.interactivebrokers.com/Universal/servlet/FlexStatementService.SendRequest'

Solution

Remove the 2-line hardcoded URL override and restore the original logic:

url = url or REQUEST_URL

This allows:

  • Default behavior: use REQUEST_URL
  • Custom URLs: pass via url parameter
  • Proper API connectivity for all users

Testing

  • ✅ Tested with production IB accounts
  • ✅ API connections work after removing hardcoded URL
  • ✅ API connections fail with the hardcoded URL

Changes

  • Remove 2 lines that hardcode the URL
  • Restore original URL selection logic
  • No other changes needed

This is a critical fix for API connectivity.

Commit 0a4989c introduced a hardcoded URL override in request_statement()
that breaks API connectivity for many users:

    ### AKE FIX
    url = 'https://ndcdyn.interactivebrokers.com/portal.flexweb/api/v1/flexQuery'

This line forces all requests to use a non-standard API endpoint, causing
timeout errors like 'Request Timeout, re-sending...' for users relying on
the standard IB FlexQuery API endpoints.

The request_statement() function already has proper URL handling via the
REQUEST_URL constant and optional url parameter. This hardcoded override
bypasses that logic and breaks existing functionality.

Impact:
- Users experience API timeouts and connection failures
- The url parameter to request_statement() is completely ignored
- Applications using this library cannot connect to IB API

Solution:
Remove the hardcoded URL override and restore the original URL selection
logic: url = url or REQUEST_URL

This allows the function to work with both the default REQUEST_URL and
any custom URLs passed via the url parameter.

Fixes connectivity issues introduced in commit 0a4989c.
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

Successfully merging this pull request may close these issues.

1 participant