1. While we would like to get some data from the server with authorization, we should apply token from the website frist. Then we pass token in the request command by using headers.

  headers = {"Authorization": "token 1f36137fbbe1602f779300dad26e4c1b7fbab631"}  

  response = requests.get("https://api.github.com/users/VikParuchuri", headers=headers)

2. Making a GET request to https://api.github.com/user will give you information about the user that the authentication token is for.

posted on 2016-11-15 08:59  阿难1020  阅读(99)  评论(0编辑  收藏  举报