Yields the redirected URL, or None.
(self, timeout=10)
| 471 | |
| 472 | @property |
| 473 | def redirect(self, timeout=10): |
| 474 | """ Yields the redirected URL, or None. |
| 475 | """ |
| 476 | if self.__dict__["_redirect"] is None: |
| 477 | try: |
| 478 | r = self.open(timeout).geturl() |
| 479 | except URLError: |
| 480 | r = None |
| 481 | self.__dict__["_redirect"] = r != self.string and r or "" |
| 482 | return self.__dict__["_redirect"] or None |
| 483 | |
| 484 | def __str__(self): |
| 485 | return bytestring(self.string) |