Skip to content
sample8.ipynb 1.83 KiB
Newer Older
Andreas's avatar
Andreas committed
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "import json"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Create a WebarchivSession Object with convenience methods for easy access with your API-Key "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from webarchiv import WebarchivSession\n",
    "\n",
    "apikey = '2pm8i0hnmpcTK4Oj4CUeBoZd7vywrm4c'\n",
    "w = WebarchivSession(apikey)\n"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {},
   "source": [
    "request archiving a Webpage"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'nomination_id': 247, 'seed': 'http://www.onb.ac.at', 'nominationtype': 5}\n"
     ]
    }
   ],
   "source": [
    "response = w.savePage(\"http://www.onb.ac.at\")\n",
    "\n",
    "if response.status_code == 201:\n",
    "    print(response.json())\n",
    "else:\n",
    "    print(\"Error \", response.status_code)\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "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.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}