Skip to content

httpx.HTTPStatusError: Redirect response '302 Moved Temporarily' #1952

@daeeros

Description

@daeeros

I have this code:

class Tracker:

    def __init__(self, login, password):

        self.login = login
        self.password = password
        self.api_url = 'https://tracking.russianpost.ru/rtm34?wsdl'

        httpx_client = httpx.AsyncClient(auth=(self.login, self.password))

        self.client = zeep.AsyncClient(
            self.api_url,
            transport=AsyncTransport(client=httpx_client),
            settings=zeep.Settings(strict=False, xml_huge_tree=True,)
        )

    async def get_history(self, barcode):

        return await self.client.service.getOperationHistory(
            OperationHistoryRequest={
                'Barcode': barcode,
                'MessageType': '0'
            },
            AuthorizationHeader={
                'login': self.login,
                'password': self.password,
            },
        )

But when it try to make auth, i getting error:

httpx.HTTPStatusError: Redirect response '302 Moved Temporarily' for url 'https://tracking.russianpost.ru/rtm34?wsdl'
Redirect location: 'https://tracking.russianpost.ru/tracking-web-static/rtm34_wsdl.xml'
For more information check: https://httpstatuses.com/302

How can if fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions