Skip to content

Follow multiple redirects instead of just one #1127

Closed

Description

@jacalata

This question gave a reasonable scenario of four redirections, and it looks like browsers allow 10-20, which is closer to what I thought. I think 20 seems generous but not too much of a time-waster.

Originally posted by @jacalata in #1125 (comment)

Activity

  1. nosnilmot commented on Feb 16, 2023

    @nosnilmot
    Contributor

    related: how about supporting redirects for all API requests in general?

    diff --git a/tableauserverclient/server/endpoint/endpoint.py b/tableauserverclient/server/endpoint/endpoint.py
    index b1a42b2..4425574 100644
    --- a/tableauserverclient/server/endpoint/endpoint.py
    +++ b/tableauserverclient/server/endpoint/endpoint.py
    @@ -83,7 +83,11 @@ class Endpoint(object):
                 redacted = helpers.strings.redact_xml(content[:1000])
                 logger.debug("request content: {}".format(redacted))
     
    -        server_response = method(url, **parameters)
    +        server_response = method(url, allow_redirects=False, **parameters)
    +        if server_response.status_code == 301:
    +            server_response = method(
    +                server_response.headers["Location"].split("?")[0], allow_redirects=False, **parameters
    +            )
             self._check_status(server_response, url)
     
             loggable_response = self.log_response_safely(server_response)

    Rationale: I've just migrated a Tableau Server to a new domain and set up redirect from old domain to new to support user bookmarks, but this breaks scripts using server-client-python because a POST becomes a GET following an HTTP 301 redirect and they have very different meanings in REST API (and no I cannot use an HTTP 308 redirect because AWS, boo).

  2. jacalata commented on Feb 16, 2023

    @jacalata
    ContributorAuthor

    That sounds pretty doable, I hadn't thought of a use-case for it.

  3. github-actions commented on Aug 6, 2026

    @github-actions

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. If this is still relevant, please comment to keep it open.

  4. added
    in-progressIssues that are in-progress of being fixed
    and removed on Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions