diff options
author | Ian Cordasco <graffatcolmingov@gmail.com> | 2013-05-11 14:44:11 -0400 |
---|---|---|
committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2013-05-11 14:44:11 -0400 |
commit | 39af7fd846ead9965dc56b000e555294535cc5de (patch) | |
tree | d7d07d259b7852650931ea952efa7882970a7e5b /README.rst | |
parent | 05dad4aaffe710759bd74fac6860f70e1569cdf9 (diff) | |
download | uritemplates-39af7fd846ead9965dc56b000e555294535cc5de.tar.gz |
Fix README
Totally forgot to update it when I updated the API
Diffstat (limited to 'README.rst')
-rw-r--r-- | README.rst | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -4,21 +4,18 @@ uritemplate Simple python library to deal with `URI Templates`_. When complete the API should look something like:: - from uritemplate import Template, expand + from uritemplate import URITemplate, expand - t = Template('https://api.github.com/users/sigmavirus24/gists{/gist_id}') + gist_uri = 'https://api.github.com/users/sigmavirus24/gists{/gist_id}' + t = URITemplate(gist_uri) print(t.expand(gist_id=123456)) # => https://api.github.com/users/sigmavirus24/gists/123456 # or - print(expand( - 'https://api.github.com/users/sigmavirus24/gists{/gist_id}', - gist_id=123456 - )) + print(expand(gist_uri, gist_id=123456)) - # And possibly - t = Template('https://api.github.com/users/sigmavirus24/gists{/gist_id}') - t.gist_id = 123456 - print(t.expand()) + # also + t.expand({'gist_id': 123456}) + expand(gist_uri, {'gist_id': 123456}) .. _URI Templates: http://tools.ietf.org/html/rfc6570 |