Created
January 11, 2016 21:57
-
-
Save ICBacon/b0f824cca75ae9a5a893 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "## [Github Organization Members](https://developer.github.com/v3/orgs/members/)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 75, | |
| "metadata": { | |
| "collapsed": false | |
| }, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "The yamlmagic extension is already loaded. To reload it, use:\n", | |
| " %reload_ext yamlmagic\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "from getGithubRequests import getGithubRequests\n", | |
| "%load_ext yamlmagic\n", | |
| "\n", | |
| "import ipywidgets\n", | |
| "from IPython.display import display\n", | |
| "from IPython.html import widgets" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 76, | |
| "metadata": { | |
| "collapsed": true | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "organization = widgets.Text(\n", | |
| " description= 'Organization/Repository',\n", | |
| " value= 'NumPy/numpy',\n", | |
| ")\n", | |
| "organization" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 77, | |
| "metadata": { | |
| "collapsed": false | |
| }, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "application/javascript": [ | |
| "\n", | |
| " require(\n", | |
| " [\n", | |
| " \"notebook/js/codecell\",\n", | |
| " \"codemirror/mode/yaml/yaml\"\n", | |
| " ],\n", | |
| " function(cc){\n", | |
| " cc.CodeCell.options_default.highlight_modes.magic_yaml = {\n", | |
| " reg: [\"^%%yaml\"]\n", | |
| " }\n", | |
| " }\n", | |
| " );\n", | |
| " " | |
| ], | |
| "text/plain": [ | |
| "<IPython.core.display.Javascript object>" | |
| ] | |
| }, | |
| "metadata": {}, | |
| "output_type": "display_data" | |
| } | |
| ], | |
| "source": [ | |
| "%%yaml githubRequests \n", | |
| "members: # <Name of file>.json\n", | |
| " maxResponse: 30 # expected number elements in response\n", | |
| " paginate: Yes\n", | |
| " url: https://api.github.com/orgs/:org/members" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 78, | |
| "metadata": { | |
| "collapsed": false | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "repo = False\n", | |
| "if '/' in organization.value:\n", | |
| " org, repo = organization.value.split('/')\n", | |
| "else:\n", | |
| " org = organization.value" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 79, | |
| "metadata": { | |
| "collapsed": false | |
| }, | |
| "outputs": [ | |
| { | |
| "ename": "FileNotFoundError", | |
| "evalue": "[WinError 3] The system cannot find the path specified: '../../data\\\\NumPy/numpy'", | |
| "output_type": "error", | |
| "traceback": [ | |
| "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", | |
| "\u001b[1;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", | |
| "\u001b[1;32m<ipython-input-79-8f85960ec791>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;34m'access_token'\u001b[0m\u001b[1;33m:\u001b[0m \u001b[1;34m'3ea9cddba39ce7eed367411b565c87191ebaac36'\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6\u001b[0m },\n\u001b[1;32m----> 7\u001b[1;33m \u001b[0mverbose\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 8\u001b[0m )\n", | |
| "\u001b[1;32mC:\\Users\\ianba\\Documents\\GitHub\\social-media\\github\\notebook\\getGithubRequests.py\u001b[0m in \u001b[0;36mgetGithubRequests\u001b[1;34m(manifest, org, repo, params, write_to, maxPageRequest, verbose)\u001b[0m\n\u001b[0;32m 28\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 29\u001b[0m \u001b[1;32mif\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mos\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mexists\u001b[0m\u001b[1;33m(\u001b[0m \u001b[0mwriteDir\u001b[0m \u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 30\u001b[1;33m \u001b[0mos\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmkdir\u001b[0m\u001b[1;33m(\u001b[0m \u001b[0mwriteDir\u001b[0m \u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 31\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 32\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mrepo\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |
| "\u001b[1;31mFileNotFoundError\u001b[0m: [WinError 3] The system cannot find the path specified: '../../data\\\\NumPy/numpy'" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "getGithubRequests( \n", | |
| " manifest = githubRequests,\n", | |
| " org = organization.value,\n", | |
| " params = {\n", | |
| " 'access_token': '3ea9cddba39ce7eed367411b565c87191ebaac36'\n", | |
| " },\n", | |
| " verbose = True\n", | |
| ")" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": { | |
| "collapsed": true | |
| }, | |
| "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.5.1" | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 0 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment