mardi 27 juin 2017

How to print the content of a variable in python testing within a virtual environment on command line

I have a question pertaining to testing within a virtual environment on command line. I am checking if the following python code:

import requests
headers = {"X-Access-Token": "your_api_token"}
url = "https://api.apps.com"
result = requests.get(url, headers=headers)

will give the following response:

{
  "api_version": "0.0.9",
  "store_name": "Test store",
  "store_url": "test.myshopify.com"
}

I'm testing this by typing in the following into my virtual environment on command line (also, just to note, I'm on a preprod server):

    (env) SAS@preprod:~$ python
    import requests
    headers = {"X-Access-Token": "abc123"}
    url = "https://api.apps.com"
    result = requests.get(url, headers=headers)
    print result

When I type print result, however, I get:

    <Response [200]>

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire