Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<bound method Response.json of <Response [200]>>

Tags:

python

I trying to make a request GET to https://randomuser.me/api/

import requests
import json


url = "https://randomuser.me/api/"
data = requests.get(url).json

print data

I kept getting

# <bound method Response.json of <Response [200]>>

How do I see the json response ? Something like this

{
    "results": [
        {
            "user": {
                "gender": "female",
                "name": {
                    "title": "ms",
                    "first": "kerttu",
                    "last": "tervo"
                },
                "location": {
                    "street": "9102 aleksanterinkatu",
                    "city": "eurajoki",
                    "state": "pirkanmaa",
                    "zip": 67561
                },
                "email": "[email protected]",
                "username": "silvercat709",
                "password": "papa",
                "salt": "tOCPX2GL",
                "md5": "86c60371eeb94596916d66cee898c869",
                "sha1": "d06c4f2e43f8c0e53d88e538655f1152169ce575",
                "sha256": "5a6b011841b27b08c38d2091dfb3d7ca50f55192ca0fcf6929dae098316c9aae",
                "registered": 1419602511,
                "dob": 1266822680,
                "phone": "03-479-964",
                "cell": "047-950-61-69",
                "HETU": "220210A290R",
                "picture": {
                    "large": "https://randomuser.me/api/portraits/women/68.jpg",
                    "medium": "https://randomuser.me/api/portraits/med/women/68.jpg",
                    "thumbnail": "https://randomuser.me/api/portraits/thumb/women/68.jpg"
                }
            }
        }
    ],
    "nationality": "FI",
    "seed": "7d24284202c2cfdb06",
    "version": "0.8"
}
like image 919
code-8 Avatar asked Mar 26 '16 20:03

code-8


1 Answers

Actually you should call it (since there is method).

data = requests.get(url).json()
like image 126
xiº Avatar answered Nov 05 '22 16:11

xiº