You are using Python 3, and the blog post is targeting Python 2. The Python 3 function json.loads()expects unicode decoded text, not the original bytestring response that returns response.content.
, json.loads(), requests, JSON , response.json():
es.index(index='sw', doc_type='people', id=i, body=r.json())