(string)
| 52 | return isinstance(string, unicode) and string.encode("utf-8") or str(string) |
| 53 | |
| 54 | def normalize(string): |
| 55 | # Normalize accents (é => e) for services that have problems with utf-8 |
| 56 | # (used to be the case with Yahoo BOSS but this appears to be fixed now). |
| 57 | string = utf8(string) |
| 58 | for k, v in _diacritics.items(): |
| 59 | for v in v: |
| 60 | string = string.replace(v, k) |
| 61 | return string |
| 62 | |
| 63 | def base(url, data={}, method="GET"): |
| 64 | # Signature base string: http://tools.ietf.org/html/rfc5849#section-3.4.1 |