Remove explicit unicode literal in README.md and doc (#5336)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* [remove] remove "u" prefix in README and documentation examples
authored by Alessio Izzo · committed by GitHub · parent 2758124 · Browse files · 4 files·+17 added−17 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+17 added−17 removed
- other:+17 added−17 removed
Provenance
- Commit
bebf525- Tree
a7a2074- Author
Alessio Izzo <alessio.izzo86@gmail.com>- Committer
GitHub <noreply@github.com>- Parent
2758124
4 files changed+17 added−17 removed
modified:docs/user/advanced.rst+11 added-11 removed
696 unmodified lines697 698 >>> commit_data = r.json()699 700 >>> print(commit_data.keys())701- [u'committer', u'author', u'url', u'tree', u'sha', u'parents', u'message']701+ ['committer', 'author', 'url', 'tree', 'sha', 'parents', 'message']702 703- >>> print(commit_data[u'committer'])704- {u'date': u'2012-05-10T11:10:50-07:00', u'email': u'me@kennethreitz.com', u'name': u'Kenneth Reitz'}703+ >>> print(commit_data['committer'])704+ {'date': '2012-05-10T11:10:50-07:00', 'email': 'me@kennethreitz.com', 'name': 'Kenneth Reitz'}705 706- >>> print(commit_data[u'message'])706+ >>> print(commit_data['message'])707 makin' history708 709 So far, so simple. Well, let's investigate the GitHub API a little bit. Now,710 we could look at the documentation, but we might have a little more fun if we34 unmodified lines745 200746 747 >>> issue = json.loads(r.text)748 749- >>> print(issue[u'title'])749+ >>> print(issue['title'])750 Feature any http verb in docs751 752- >>> print(issue[u'comments'])752+ >>> print(issue['comments'])753 3754 755 Cool, we have three comments. Let's take a look at the last of them.756 757 ::758 759- >>> r = requests.get(r.url + u'/comments')759+ >>> r = requests.get(r.url + '/comments')760 >>> r.status_code761 200762 763 >>> comments = r.json()764 765 >>> print(comments[0].keys())766- [u'body', u'url', u'created_at', u'updated_at', u'user', u'id']766+ ['body', 'url', 'created_at', 'updated_at', 'user', 'id']767 768- >>> print(comments[2][u'body'])768+ >>> print(comments[2]['body'])769 Probably in the "advanced" section770 771 Well, that seems like a silly place. Let's post a comment telling the poster772 that he's silly. Who is the poster, anyway?773 774 ::775 776- >>> print(comments[2][u'user'][u'login'])776+ >>> print(comments[2]['user']['login'])777 kennethreitz778 779 OK, so let's tell this Kenneth guy that we think this example should go in the780 quickstart guide instead. According to the GitHub API doc, the way to do this21 unmodified lines802 >>> r.status_code803 201804 805 >>> content = r.json()806- >>> print(content[u'body'])806+ >>> print(content['body'])807 Sounds great! I'll get right on it.808 809 Brilliant. Oh, wait, no! I meant to add that it would take me a while, because810 I had to go feed my cat. If only I could edit this comment! Happily, GitHub222 unmodified linesmodified:docs/user/quickstart.rst+2 added-2 removed
91 unmodified lines92 >>> import requests93 94 >>> r = requests.get('https://api.github.com/events')95 >>> r.text96- u'[{"repository":{"open_issues":0,"url":"https://github.com/...96+ '[{"repository":{"open_issues":0,"url":"https://github.com/...97 98 Requests will automatically decode content from the server. Most unicode99 charsets are seamlessly decoded.100 46 unmodified lines147 >>> import requests148 149 >>> r = requests.get('https://api.github.com/events')150 >>> r.json()151- [{u'repository': {u'open_issues': 0, u'url': 'https://github.com/...151+ [{'repository': {'open_issues': 0, 'url': 'https://github.com/...152 153 In case the JSON decoding fails, ``r.json()`` raises an exception. For example, if154 the response gets a 204 (No Content), or if the response contains invalid JSON,155 attempting ``r.json()`` raises ``ValueError: No JSON object could be decoded``.410 unmodified linesmodified:docs/index.rst+2 added-2 removed
33 unmodified lines34 'application/json; charset=utf8'35 >>> r.encoding36 'utf-8'37 >>> r.text38- u'{"type":"User"...'38+ '{"type":"User"...'39 >>> r.json()40- {u'private_gists': 419, u'total_private_repos': 77, ...}40+ {'private_gists': 419, 'total_private_repos': 77, ...}41 42 See `similar code, sans Requests <https://gist.github.com/973705>`_.43 44 92 unmodified linesmodified:README.md+2 added-2 removed
36 unmodified lines3738394041414243434445464779 unmodified lines36 unmodified lines'application/json; charset=utf8'>>> r.encoding'utf-8'>>> r.textu'{"type":"User"...''{"type":"User"...'>>> r.json(){u'disk_usage': 368627, u'private_gists': 484, ...}{'disk_usage': 368627, 'private_gists': 484, ...}```
79 unmodified lines