<jupyter_start><jupyter_text>test-request<jupyter_code>import csv
import json
import os
import pprint

import pandas as pd
import requests
# get api token and set authorization
api_token = os.environ['GITHUB_API_TOKEN']
headers = {'Authorization': f'token {api_token}'}
# set url to a graphql endpoint
url = 'https://api.github.com/graphql'
# add a json query
query = """
{
  organization(login: "jupyterhub") {
    name
    repository(name: "binderhub") {
        name
        issues(last: 5) {
          edges {
            node {
              number
              title
            }
          }
        }    
    }
  }
}
"""
# submit the request
r = requests.post(url=url, json={'query': query}, headers=headers)
binderhub = r.json()
binderhub
issue_list = binderhub['data']['organization']['repository']['issues']['edges']
issue_list<jupyter_output><empty_output><jupyter_text>Report: Last 5 issues for a repo<jupyter_code>print(f"{binderhub['data']['organization']['repository']['name']}: last five issues submitted")
for issue in issue_list:
    print(f"{issue['node']['number']:6}  {issue['node']['title']:30}")<jupyter_output>binderhub: last five issues submitted
   344  Improve CONTRIBUTING.md       
   345  Upgrade to kubernetes client version 4.0
   349  race condition mounting docker-in-docker socket in build
   350  Consider *not* launching automatically
   351  Awesome bar functionality<jupyter_text>Let's try another repo- make it a little more generic using `response` as a variable- select last 10 issues<jupyter_code># add a json query
query = """
{
  organization(login: "jupyterhub") {
    name
    repository(name: "jupyterhub") {
        name
        issues(last: 10) {
          edges {
            node {
              number
              title
            }
          }
        }    
    }
  }
}
"""
r = requests.post(url=url, json={'query': query}, headers=headers)
response = r.json()
issue_list = response['data']['organization']['repository']['issues']['edges']
print(f"{response['data']['organization']['repository']['name']}: last 10 issues submitted")
for issue in issue_list:
    print(f"{issue['node']['number']:6}  {issue['node']['title']:30}")<jupyter_output>jupyterhub: last 10 issues submitted
  1573  more activity tracking        
  1574  Jupyter cannot find Three.Js files - URL redirection not working *updated*
  1576  anchor links on markdown docs pages are unreliable
  1579  LocalAuthenticator question   
  1580  Specify Kubernetes volume claims in Jupyterhub spawner
  1582  Jupyterhub shared service error
  1583  c.JupyterHub.logo_file is not working on after Jupyterhub Version: 0.8.1 upgrade
  1584  config c.LocalProcessSpawner.mem_limit Issue
  1585  Prometheus metrics to add to JupyterHub
  1586  Errno 8: Nodename nor servname provided
{'fraction_non_alphanumeric': 0.11464285714285714, 'fraction_numerical': 0.0275, 'mean_word_length': 3.517741935483871, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '197722', 'license': 'MIT', 'n_tokens_mistral': 912, 'n_tokens_neox': 854, 'n_words': 241, 'path': 'docs/examples/test-request.ipynb', 'repo_name': 'willingc/pyquery-ql', 'size': '2800'}