Skip to content

Instantly share code, notes, and snippets.

@phenders
Created August 24, 2018 20:08
Show Gist options
  • Save phenders/6d51910f6fd4c725666937b272befc0f to your computer and use it in GitHub Desktop.
Save phenders/6d51910f6fd4c725666937b272befc0f to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"580"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import requests\n",
"\n",
"session = requests.Session()\n",
"headers = {'authorization': 'Bearer ' + '<YOUR_API_KEY>'}\n",
"session.headers.update(headers)\n",
"\n",
"url = 'https://public.enigma.com/api/datasets/'\n",
"phrase = 'michael cohen'\n",
"params = {'query': phrase, \n",
" 'row_limit':1000, \n",
" 'match_metadata':'false', \n",
" 'include_serialids':'false'\n",
" }\n",
"response = session.head(url, headers=headers, params=params)\n",
"ds_count = int(response.headers.get('content-range').split(\"/\")[1])\n",
"ds_count"
]
}
],
"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": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment