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

History attribute from httpx response object #32

Open
1 task done
DanielOX opened this issue Jan 16, 2025 · 0 comments
Open
1 task done

History attribute from httpx response object #32

DanielOX opened this issue Jan 16, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@DanielOX
Copy link

DanielOX commented Jan 16, 2025

Have you searched if there an existing feature request for this?

  • I have searched the existing requests

Feature description

Hi,

As of today, There is no way of getting history of redirects made by the Response Adapter. The httpx module provides an history attribute. This attribute keeps track of responses made by each re-direct responses.

I am working on PR but wanted to get @D4Vinci opinion on it.

example: https://wikipedia.com redirects you to https://wikipedia.org.

from scrapling import Fetcher

url = 'https://wikipedia.com'

# init fetcher
https_fetcher = Fetcher()

# returns a response adapter
response = https_fetcher.get(url=url , stealthy_headers=True, follow_redirects=True)

# see re-direct history responses

print(r.history)

-- output
[<Response [301 Moved Permanently]>]

I am thinking of implementing it this way:

@DanielOX DanielOX added the enhancement New feature or request label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant