Skip to content

Instantly share code, notes, and snippets.

@bollwyvl
Created September 25, 2015 17:56
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Related to issue [#507](https://github.com/jupyter/nbviewer/issues/507)."
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from difflib import unified_diff\n",
"import json\n",
"import cgi\n",
"from tornado.httpclient import HTTPClient"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"bb_url = \"https://bitbucket.org/sandiego206/asdasd/raw/master/Untitled.ipynb\"\n",
"gh_url = \"https://gist.githubusercontent.com/willingc/5de6a2d7aeebde35ccc8/raw/e9aa7ef9f6cc0c7790b274d2b126ca8c80c0b1b5/mytest.ipynb\""
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"{'Accept-Ranges': 'bytes',\n",
" 'Access-Control-Allow-Origin': '*',\n",
" 'Cache-Control': 'max-age=300',\n",
" 'Connection': 'close',\n",
" 'Content-Length': '561',\n",
" 'Content-Security-Policy': \"default-src 'none'\",\n",
" 'Content-Type': 'text/plain; charset=utf-8',\n",
" 'Date': 'Fri, 25 Sep 2015 17:55:35 GMT',\n",
" 'Etag': '\"8887cff9a8944b80e55b87b8ab57fbe178ad87dd\"',\n",
" 'Expires': 'Fri, 25 Sep 2015 18:00:35 GMT',\n",
" 'Source-Age': '0',\n",
" 'Strict-Transport-Security': 'max-age=31536000',\n",
" 'Vary': 'Authorization,Accept-Encoding',\n",
" 'Via': '1.1 varnish',\n",
" 'X-Cache': 'MISS',\n",
" 'X-Cache-Hits': '0',\n",
" 'X-Content-Type-Options': 'nosniff',\n",
" 'X-Frame-Options': 'deny',\n",
" 'X-Served-By': 'cache-jfk1023-JFK',\n",
" 'X-Xss-Protection': '1; mode=block'}"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ghr = HTTPClient().fetch(gh_url)\n",
"ghr.headers"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"{'Cache-Control': 'max-age=0',\n",
" 'Connection': 'close',\n",
" 'Content-Language': 'en',\n",
" 'Content-Type': 'text/plain',\n",
" 'Date': 'Fri, 25 Sep 2015 17:55:35 GMT',\n",
" 'Expires': 'Fri, 25 Sep 2015 17:55:35 GMT',\n",
" 'Last-Modified': 'Fri, 25 Sep 2015 17:55:35 GMT',\n",
" 'Server': 'nginx/1.6.2',\n",
" 'Strict-Transport-Security': 'max-age=31436000',\n",
" 'Transfer-Encoding': 'chunked',\n",
" 'Vary': 'Accept-Language, Cookie',\n",
" 'X-Cache-Status': 'MISS',\n",
" 'X-Consumed-Content-Encoding': 'gzip',\n",
" 'X-Content-Type-Options': 'nosniff',\n",
" 'X-Frame-Options': 'SAMEORIGIN',\n",
" 'X-Render-Time': '0.0241279602051',\n",
" 'X-Request-Count': '135',\n",
" 'X-Served-By': 'app-104',\n",
" 'X-Static-Version': 'dd03ff46a1b4',\n",
" 'X-Version': 'dd03ff46a1b4'}"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bbr = HTTPClient().fetch(bb_url)\n",
"bbr.headers"
]
}
],
"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.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment