Unicode literals for Python 2 compatibility; fix typo in index.rst.
This commit is contained in:
parent
15ae55b6c3
commit
8d9ac92fbd
|
@ -32,10 +32,10 @@ Then, hyperlink away!
|
|||
```python
|
||||
from hyperlink import URL
|
||||
|
||||
url = URL.from_text('http://github.com/python-hyper/hyperlink?utm_source=README')
|
||||
url = URL.from_text(u'http://github.com/python-hyper/hyperlink?utm_source=README')
|
||||
utm_source = url.get(u'utm_source')
|
||||
better_url = url.replace(scheme='https', port=443)
|
||||
org_url = better_url.click('.')
|
||||
better_url = url.replace(scheme=u'https', port=443)
|
||||
org_url = better_url.click(u'.')
|
||||
```
|
||||
|
||||
See the full API docs on [Read the Docs][docs].
|
||||
|
|
|
@ -39,15 +39,15 @@ Then, URLs are just an import away::
|
|||
|
||||
from hyperlink import URL
|
||||
|
||||
url = URL.from_text('http://github.com/python-hyper/hyperlink?utm_souce=readthedocs')
|
||||
url = URL.from_text(u'http://github.com/python-hyper/hyperlink?utm_source=readthedocs')
|
||||
|
||||
better_url = url.replace(scheme='https', port=443)
|
||||
org_url = better_url.click('.')
|
||||
better_url = url.replace(scheme=u'https', port=443)
|
||||
org_url = better_url.click(u'.')
|
||||
|
||||
print(org_url.to_text())
|
||||
# prints: https://github.com/python-hyper/
|
||||
|
||||
print(better_url.get('utm_source'))
|
||||
print(better_url.get(u'utm_source'))
|
||||
# prints: readthedocs
|
||||
|
||||
See :ref:`the API docs <hyperlink_api>` for more usage examples.
|
||||
|
|
Loading…
Reference in New Issue