Transform a string like ' ' into 'scheme://host/path'. The string is returned unchanged if it's not a wrapped URL.
(url)
| 1041 | |
| 1042 | |
| 1043 | def unwrap(url): |
| 1044 | """Transform a string like '<URL:scheme://host/path>' into 'scheme://host/path'. |
| 1045 | |
| 1046 | The string is returned unchanged if it's not a wrapped URL. |
| 1047 | """ |
| 1048 | url = str(url).strip() |
| 1049 | if url[:1] == '<' and url[-1:] == '>': |
| 1050 | url = url[1:-1].strip() |
| 1051 | if url[:4] == 'URL:': |
| 1052 | url = url[4:].strip() |
| 1053 | return url |
| 1054 | |
| 1055 | |
| 1056 | def splittype(url): |