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
# Learn more about the ICNDb API at: http://www.icndb.com/api/ | |
# Learn more about the Requests library at: http://docs.python-requests.org/en/master/ | |
import requests | |
def get_joke(): | |
"""fetches and prints a random joke""" | |
url = "http://api.icndb.com/jokes/random" | |
resp = requests.get(url) | |
data = resp.json() |
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
# To start, set up a Google form that collects | |
# first name, last name, and email address from participants, | |
# then export as a CSV file and store it in the same | |
# directory as this program | |
# also, enable less secure apps in gmail before running | |
# https://support.google.com/accounts/answer/6010255?hl=en | |
import csv | |
import smtplib | |
from random import shuffle |
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
# pet license csv file available at: | |
# https://data.seattle.gov/Community/Seattle-Pet-Licenses/jguv-t9rb | |
# data provided by City of Seattle Department of Finance and | |
# Administrative Services | |
import csv | |
# row 0 = license date | |
# row 1 = license num | |
# row 2 = name |
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
# standard library | |
import random | |
from urllib.request import urlopen | |
# third-party | |
from bs4 import BeautifulSoup | |
# make an HTTP request to get the Zen of Python | |
url = "https://www.python.org/dev/peps/pep-0020/" | |
html = urlopen(url) |
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
# Python's built-in module for encoding and decoding JSON data | |
import json | |
# Python's built-in module for opening and reading URLs | |
from urllib.request import urlopen | |
# this api returns the current number of people in space | |
url = "http://api.open-notify.org/astros.json" | |
# send a request and get a JSON response | |
resp = urlopen(url) |
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
# Python's built-in module for encoding and decoding JSON data | |
import json | |
# Python's built-in module for opening and reading URLs | |
from urllib.request import urlopen | |
# sample ISBN for testing: 1593276036 | |
while True: | |
# create getting started variables |