{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-19T12:38:00.144973Z",
     "start_time": "2019-01-19T12:38:00.013721Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "200\n",
      "87\n"
     ]
    }
   ],
   "source": [
    "import requests\n",
    "\n",
    "base_url = 'http://127.0.0.1:5000/graphql'\n",
    "headers = {'content-type': 'application/json'}\n",
    "        \n",
    "# Get batch list\n",
    "payload = '{\"query\": \"{peopleList{edges{node{id}}}}\"}'\n",
    "response = requests.post(base_url, headers=headers, data=payload)\n",
    "json = response.json()\n",
    "\n",
    "# self.assertEqual(response.status_code, 200)\n",
    "# self.assertGreater(len(json['data']['peopleList']['edges']), 0)\n",
    "print(response.status_code)\n",
    "print(len(json['data']['peopleList']['edges']))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-01-19T12:38:02.867982Z",
     "start_time": "2019-01-19T12:38:02.845170Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Tatooine\n"
     ]
    }
   ],
   "source": [
    "# Get batch list\n",
    "payload = '''\n",
    "{\"query\": \"{planet(id:\\\\\"UGxhbmV0OjE=\\\\\"){name}}\"}\n",
    "'''\n",
    "response = requests.post(base_url, headers=headers, data=payload)\n",
    "json = response.json()\n",
    "print(json['data']['planet']['name'])"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
