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
# You can place these lines of code in a colab notebook to login to Github, and create or load a Google drive file. | |
# Running this authentication cell will print a message with a hyperlink and a text cell | |
# visit the link, sign into google, copy the generated authentication code, paste the code in the generated text cell above, and press 'enter'. | |
# this will link the Colab notebook to your Google drive. | |
from google.colab import drive | |
drive.mount('drive') | |
# save data frame as csv file with google.colab.drive |
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
from functools import wraps | |
import requests, json, datetime | |
from time import time | |
from flask import Flask, request | |
from flask_restplus import Resource, Api, abort, fields, inputs, reqparse | |
from itsdangerous import SignatureExpired, JSONWebSignatureSerializer, BadSignature | |
from flask_sqlalchemy import SQLAlchemy | |
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
# Download all Github-archived EEBO-TCP xml files from their associated repositories on Github | |
# Files were created "by converting TCP files to TEI P5 using tcp2tei.xsl,TEI @ Oxford." | |
# Running this script requires two preparatory steps. Either could be eliminated with a simple modification | |
# 1. Creating a destination folder called tcp (all lowercase) that is placed in the same folder as this script | |
# 2. Downloading "TCP.csv" (all caps filename) from https://github.com/textcreationpartnership/Texts and placing it in the same folder as this script | |
import requests | |
import pandas as pd | |
# comment these lines out if you have the file already |
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
import requests | |
import json | |
# This script demonstrates how to query annotations for a particular URL using the hypothes.is API. An API key is required. | |
# The end result of this script is a Python dictionary with annotation data in it. Top save to csv or other format, further parsing would be required | |
KEY = "Your API key here" | |
URL = "Some URL Here" | |
#a dictionary containing necessary http headers |
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
from pyzotero import zotero | |
# See https://github.com/urschrei/pyzotero for documentation | |
library_id = "Your library id" | |
api_key= "Your API key" | |
collection_id = "Your collection ID" | |
library_type = "group" #or user | |
zot = zotero.Zotero(library_id, library_type, api_key) |
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
# This python script will loop through a set of Worldcat ids, download metadata for each id, and store full xml values in sqlite format (datastore.db) for later parsing. | |
# If the daily key limit is reached, the script will terminate and, the next time you run it, the script will look for Worldcat ids in the database and skip them if present. | |
# Therefore, the intended way to run this script is as a daily cron job until data is downloaded for every id. | |
#Worldcat ids go here in list format, like this: ids_list = [11111, 22222, 33333] | |
ids_list = [] | |
#replace 'Your key here' with API key | |
KEY = 'Your key here' |
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
#! /usr/bin/env python | |
# Illustration of many data processing steps using the Federalist Papers | |
# | |
# Kevin Quinn | |
# 9/15/2007 | |
# edited Andy Eggers 9/22/2007 to add progress reporting and conform to most recent nltk distribution | |
print "Importing necessary modules . . . " | |
# import the necessary modules |
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
# -*- coding: utf-8 -*- | |
""" | |
Flask-Login example | |
=================== | |
This is a small application that provides a trivial demonstration of | |
Flask-Login, including remember me functionality. | |
:copyright: (C) 2011 by Matthew Frazier. | |
:license: MIT/X11, see LICENSE for more details. | |
""" |
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
""" | |
Creates a list of URLs to stdout based on repeating patterns found in the site, suitable for use with WGET or CURL. | |
""" | |
import datetime | |
scopes=[ | |
"aries", | |
"taurus", |
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
""" | |
Example of using the old BeautifulSoup API to extract content from downloaded html files into CSV... if you're doing this sort of thing today, I recommend using the newer lxml interface directly, but lxml also has a BeautifulSoup compatibility layer. | |
""" | |
import os | |