0

I am trying to create a program to gather informatiom about trending prices from https://www.cardmarket.com/en/Magic with Python, lxml and request.

I managed to gather all necessary data except one case. When there is a card from only 1 extension e.g. Hagra Diabolist, website will reroute the address to https://www.cardmarket.com/en/Magic/Products/Singles/Zendikar/Hagra-Diabolist even when you provided: https://www.cardmarket.com/en/Magic/MainPage/showSearchResult?searchFor=HagraDiabolist

Is there a way to check if the current address of the lxml request is the same as provided in the request.

Unless you have another solution for this case.

Thanks in advance!

  • You are using the `requests` library? If you're doing something like `r = requests(url)` and then passing `r.text` to `lxml`, then you should still have access to `r.history` (which'll contain redirect history and your original url I believe) ? – Jon Clements Sep 01 '18 at 09:42
  • Thanks Jon! I used the what you said and in r.history there is list which contains . This will resolve my problem :) – Kamil Święch Sep 01 '18 at 09:47
  • Want to write a self-answer ? – Jon Clements Sep 01 '18 at 09:48
  • Actually - found a good duplicate for others that might be wanting the same thing... saves either of us writing answers and this question might serve as a good signpost for it later - thanks for asking it. – Jon Clements Sep 01 '18 at 09:53

0 Answers0