Skip to content

Commit

Permalink
Merge pull request #186 from hugovk/updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Sep 26, 2020
2 parents ac2efb6 + 9f0879b commit b5e049e
Show file tree
Hide file tree
Showing 50 changed files with 198 additions and 1,393 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/lint.yml
@@ -0,0 +1,40 @@
name: Lint

on: [push, pull_request]

env:
FORCE_COLOR: 1

jobs:
build:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Cache
uses: actions/cache@v2
with:
path: |
~/.cache/pip
~/.cache/pre-commit
key:
lint-v1-${{ hashFiles('**/setup.py') }}-${{
hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
lint-v1-
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U pre-commit
- name: Lint
run: pre-commit run --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
42 changes: 42 additions & 0 deletions .pre-commit-config.yaml
@@ -0,0 +1,42 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.7.2
hooks:
- id: pyupgrade
args: ["--py36-plus"]

- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
args: ["--target-version", "py36"]

- repo: https://github.com/PyCQA/isort
rev: 5.5.3
hooks:
- id: isort

- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
additional_dependencies: [flake8-2020, flake8-implicit-str-concat]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.6.0
hooks:
- id: python-check-blanket-noqa

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: check-merge-conflict
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/prettier/prettier
rev: 2.1.1
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]
11 changes: 4 additions & 7 deletions .travis.yml
Expand Up @@ -4,6 +4,7 @@ cache: pip
matrix:
fast_finish: true
include:
- python: 3.9-dev
- python: 3.8
- python: 3.7
- python: 3.6
Expand All @@ -18,16 +19,12 @@ branches:

install:
- pip install -r requirements.txt
- pip install black coveralls flake8
- pip install black coveralls

script:
- coverage run --append --source scripts test/test_gpo_member_photos.py
- coverage run --append --source scripts scripts/missing.py
- black --check --diff .
- flake8 scripts
- coverage run --append --source scripts test/test_gpo_member_photos.py
- coverage run --append --source scripts scripts/missing.py

after_success:
- coverage report
- coveralls
- pip install pycodestyle
- pycodestyle scripts/*.py
27 changes: 18 additions & 9 deletions CONTRIBUTING.md
@@ -1,19 +1,28 @@
## Contributing other photos

If GPO doesn't have a photo for someone in their member guide, we may be willing to accept a photo from another source.
If GPO doesn't have a photo for someone in their member guide, we may be willing to
accept a photo from another source.

In this case, [open a ticket](https://github.com/unitedstates/images/issues/new), and include:
In this case, [open a ticket](https://github.com/unitedstates/images/issues/new), and
include:

* The name and Bioguide ID of the member of Congress.
* A link to the image you're suggesting we incorporate, and to a page that displays that image.
* Why you believe the image is definitely official and in the public domain.
- The name and Bioguide ID of the member of Congress.
- A link to the image you're suggesting we incorporate, and to a page that displays that
image.
- Why you believe the image is definitely official and in the public domain.

When submitting a PR for an image found outside of the GPO, use the URL for the **context** of the photo, not the image source URL, as the value for `link: ` in `metadata/*.yaml`.
When submitting a PR for an image found outside of the GPO, use the URL for the
**context** of the photo, not the image source URL, as the value for `link: ` in
`metadata/*.yaml`.

## Public domain

The project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the [CC0 1.0 Universal public domain dedication][CC0].
The project is in the public domain within the United States, and copyright and related
rights in the work worldwide are waived through the [CC0 1.0 Universal public domain
dedication][cc0].

All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.
All contributions to this project will be released under the CC0 dedication. By
submitting a pull request, you are agreeing to comply with this waiver of copyright
interest.

[CC0]: http://creativecommons.org/publicdomain/zero/1.0/
[cc0]: http://creativecommons.org/publicdomain/zero/1.0/
5 changes: 3 additions & 2 deletions PULL_REQUEST_TEMPLATE.md
@@ -1,2 +1,3 @@
* [ ] *I'm acknowledging that my submission is free of all known copyright in at least the United States.* (In general, works of the federal government should satisfy this criteria.)

- [ ] _I'm acknowledging that my submission is free of all known copyright in at least
the United States._ (In general, works of the federal government should satisfy
this criteria.)
59 changes: 40 additions & 19 deletions README.md
Expand Up @@ -6,25 +6,37 @@ Public domain images of members of the US Congress.

## Using the photos

Photos are available at predictable URLs, by size and Bioguide ID. Photos are served using GitHub Pages.
Photos are available at predictable URLs, by size and Bioguide ID. Photos are served
using GitHub Pages.

```
https://theunitedstates.io/images/congress/[size]/[bioguide].jpg
```

`[size]` can be one of:

* `original` - As originally downloaded. Typically, `675x825`, but [it can vary](https://github.com/unitedstates/images/issues/1#issuecomment-35070231).
* `450x550`
* `225x275`
- `original` - As originally downloaded. Typically, `675x825`, but
[it can vary](https://github.com/unitedstates/images/issues/1#issuecomment-35070231).
- `450x550`
- `225x275`

`[bioguide]` must be a Bioguide ID. These are unique IDs for members of Congress, as defined by the [Congressional Bioguide](http://bioguide.congress.gov). They can be found and connected to many other Congressional datasets, including the partner dataset over at [unitedstates/congress-legislators](https://github.com/unitedstates/congress-legislators).
`[bioguide]` must be a Bioguide ID. These are unique IDs for members of Congress, as
defined by the [Congressional Bioguide](http://bioguide.congress.gov). They can be found
and connected to many other Congressional datasets, including the partner dataset over
at
[unitedstates/congress-legislators](https://github.com/unitedstates/congress-legislators).

**Note:** Our HTTPS permalinks are provided through CloudFlare's [Universal SSL](https://blog.cloudflare.com/introducing-universal-ssl/), which also uses "Flexible SSL" to talk to GitHub Pages' unencrypted endpoints. So, you should know that it's not an end-to-end encrypted channel, but is encrypted between your client use and CloudFlare's servers (which at least should dissociate your requests from client IP addresses).
**Note:** Our HTTPS permalinks are provided through CloudFlare's
[Universal SSL](https://blog.cloudflare.com/introducing-universal-ssl/), which also uses
"Flexible SSL" to talk to GitHub Pages' unencrypted endpoints. So, you should know that
it's not an end-to-end encrypted channel, but is encrypted between your client use and
CloudFlare's servers (which at least should dissociate your requests from client IP
addresses).

## Downloading all images of a particular size

If you want to quickly grab all images of a particular size without cloning the entire repo (and have `svn` installed), you can just do something like this:
If you want to quickly grab all images of a particular size without cloning the entire
repo (and have `svn` installed), you can just do something like this:

`svn checkout https://github.com/unitedstates/images/trunk/congress/225x275`

Expand All @@ -33,7 +45,9 @@ If you want to quickly grab all images of a particular size without cloning the
[![Build Status](https://travis-ci.org/unitedstates/images.svg?branch=gh-pages)](https://travis-ci.org/unitedstates/images)
[![Coverage Status](https://coveralls.io/repos/unitedstates/images/badge.svg?branch=gh-pages&service=github)](https://coveralls.io/github/unitedstates/images?branch=gh-pages)

This project uses a Python script that scrapes the [Government Printing Office's Member Guide](https://memberguide.gpo.gov/) for official photos of Members of Congress. You can run the script to find and fetch new photos.
This project uses a Python script that scrapes the
[Government Printing Office's Member Guide](https://memberguide.gpo.gov/) for official
photos of Members of Congress. You can run the script to find and fetch new photos.

Install dependencies with:

Expand All @@ -47,24 +61,31 @@ Run the script with:
./scripts/gpo_member_photos.py
```


## Contributing other photos

If GPO doesn't have a photo for someone in their member guide, we may be willing to accept a photo from another source.

In this case, [open a ticket](https://github.com/unitedstates/images/issues/new), and include:
If GPO doesn't have a photo for someone in their member guide, we may be willing to
accept a photo from another source.

* The name and Bioguide ID of the member of Congress.
* A link to the image you're suggesting we incorporate, and to a page that displays that image.
* Why you believe the image is definitely official and in the public domain.
In this case, [open a ticket](https://github.com/unitedstates/images/issues/new), and
include:

- The name and Bioguide ID of the member of Congress.
- A link to the image you're suggesting we incorporate, and to a page that displays that
image.
- Why you believe the image is definitely official and in the public domain.

## Public domain

The photos of members of Congress are from the Government Printing Office, which [has assured us that all photos are public domain](https://github.com/sunlightlabs/congress/issues/432#issuecomment-34481338).
The photos of members of Congress are from the Government Printing Office, which
[has assured us that all photos are public domain](https://github.com/sunlightlabs/congress/issues/432#issuecomment-34481338).

All other files in this project are [dedicated to the public domain](LICENSE). As spelled out in [CONTRIBUTING](CONTRIBUTING.md):
All other files in this project are [dedicated to the public domain](LICENSE). As
spelled out in [CONTRIBUTING](CONTRIBUTING.md):

> The project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the [CC0 1.0 Universal public domain dedication](http://creativecommons.org/publicdomain/zero/1.0/).
> The project is in the public domain within the United States, and copyright and
> related rights in the work worldwide are waived through the
> [CC0 1.0 Universal public domain dedication](http://creativecommons.org/publicdomain/zero/1.0/).
> All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.
> All contributions to this project will be released under the CC0 dedication. By
> submitting a pull request, you are agreeing to comply with this waiver of copyright
> interest.
2 changes: 1 addition & 1 deletion congress/metadata/B001304.yaml
@@ -1,2 +1,2 @@
name:
name: Office of Anthony Brown
link: https://anthonybrown.house.gov/sites/anthonybrown.house.gov/files/wysiwyg_uploaded/official.jpg
2 changes: 1 addition & 1 deletion congress/metadata/B001306.yaml
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=78590567
link: https://commons.wikimedia.org/w/index.php?curid=78590567
2 changes: 1 addition & 1 deletion congress/metadata/C001055.yaml
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=80784529
link: https://commons.wikimedia.org/w/index.php?curid=80784529
2 changes: 1 addition & 1 deletion congress/metadata/C001122.yaml
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=76586796
link: https://commons.wikimedia.org/w/index.php?curid=76586796
2 changes: 1 addition & 1 deletion congress/metadata/C001123.yaml
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=75585145
link: https://commons.wikimedia.org/w/index.php?curid=75585145
2 changes: 1 addition & 1 deletion congress/metadata/C001124.yaml
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=81932819
link: https://commons.wikimedia.org/w/index.php?curid=81932819
2 changes: 1 addition & 1 deletion congress/metadata/D000631.yaml
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=79245159
link: https://commons.wikimedia.org/w/index.php?curid=79245159
2 changes: 1 addition & 1 deletion congress/metadata/G000061.yaml
@@ -1,2 +1,2 @@
name: House Creative Services
link: https://commons.wikimedia.org/w/index.php?curid=93516904
link: https://commons.wikimedia.org/w/index.php?curid=93516904
2 changes: 1 addition & 1 deletion congress/metadata/G000578.yaml
@@ -1,2 +1,2 @@
name: @Rep_Matt_Gaetz - Twitter
name: "@Rep_Matt_Gaetz - Twitter"
link: https://twitter.com/Rep_Matt_Gaetz
2 changes: 1 addition & 1 deletion congress/metadata/G000583.yaml
@@ -1,2 +1,2 @@
name: @RepJoshG - Twitter
name: "@RepJoshG - Twitter"
link: https://twitter.com/RepJoshG
2 changes: 1 addition & 1 deletion congress/metadata/G000588.yaml
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=84184710
link: https://commons.wikimedia.org/w/index.php?curid=84184710
2 changes: 1 addition & 1 deletion congress/metadata/G000590.yaml
@@ -1,2 +1,2 @@
name: United States Congress
link: https://commons.wikimedia.org/w/index.php?curid=75592712
link: https://commons.wikimedia.org/w/index.php?curid=75592712
2 changes: 1 addition & 1 deletion congress/metadata/H001082.yaml
@@ -1,2 +1,2 @@
name: U.S. House of Representatives
link: https://commons.wikimedia.org/w/index.php?curid=75580048
link: https://commons.wikimedia.org/w/index.php?curid=75580048
2 changes: 1 addition & 1 deletion congress/metadata/H001083.yaml
@@ -1,2 +1,2 @@
name: House Creative Services
link: https://commons.wikimedia.org/w/index.php?curid=86984657
link: https://commons.wikimedia.org/w/index.php?curid=86984657
2 changes: 1 addition & 1 deletion congress/metadata/H001089.yaml
@@ -1,2 +1,2 @@
name: Senate Committee on the Judiciary
name: Senate Committee on the Judiciary
link: https://www.judiciary.senate.gov/about/members
2 changes: 1 addition & 1 deletion congress/metadata/H001090.yaml
@@ -1,2 +1,2 @@
name: US House of Representativess
link: https://commons.wikimedia.org/w/index.php?curid=75597669
link: https://commons.wikimedia.org/w/index.php?curid=75597669
2 changes: 1 addition & 1 deletion congress/metadata/J000020.yaml
@@ -1,2 +1,2 @@
name: U.S. House of Representatives
link: https://commons.wikimedia.org/w/index.php?curid=92583419
link: https://commons.wikimedia.org/w/index.php?curid=92583419
2 changes: 1 addition & 1 deletion congress/metadata/K000390.yaml
@@ -1,2 +1,2 @@
name: @RepKihuen - Twitter
name: "@RepKihuen - Twitter"
link: https://twitter.com/RepKihuen
2 changes: 1 addition & 1 deletion congress/metadata/K000395.yaml
@@ -1,2 +1,2 @@
name: House Creative Services
link: https://commons.wikimedia.org/w/index.php?curid=80784651
link: https://commons.wikimedia.org/w/index.php?curid=80784651
2 changes: 1 addition & 1 deletion congress/metadata/L000586.yaml
@@ -1,2 +1,2 @@
name: Wikimedia Commons
link: https://commons.wikimedia.org/wiki/File:Al_Lawson_115th_Congress_photo.jpg
link: https://commons.wikimedia.org/wiki/File:Al_Lawson_115th_Congress_photo.jpg
2 changes: 1 addition & 1 deletion congress/metadata/L000594.yaml
@@ -1,2 +1,2 @@
name: Office of Senator Kelly Loeffler
link: https://commons.wikimedia.org/w/index.php?curid=85928962
link: https://commons.wikimedia.org/w/index.php?curid=85928962
2 changes: 1 addition & 1 deletion congress/metadata/M000687.yaml
@@ -1,2 +1,2 @@
name: House Creative Services
link: https://commons.wikimedia.org/w/index.php?curid=93421269
link: https://commons.wikimedia.org/w/index.php?curid=93421269
2 changes: 1 addition & 1 deletion congress/metadata/M001204.yaml
@@ -1,2 +1,2 @@
name: U.S. House of Representatives
link: https://commons.wikimedia.org/w/index.php?curid=75580991
link: https://commons.wikimedia.org/w/index.php?curid=75580991
2 changes: 1 addition & 1 deletion congress/metadata/M001210.yaml
@@ -1,2 +1,2 @@
name: U.S. Congress
link: https://commons.wikimedia.org/w/index.php?curid=83284876
link: https://commons.wikimedia.org/w/index.php?curid=83284876
2 changes: 1 addition & 1 deletion congress/metadata/P000614.yaml
@@ -1,2 +1,2 @@
name: United States Congress
link: https://commons.wikimedia.org/w/index.php?curid=75731216
link: https://commons.wikimedia.org/w/index.php?curid=75731216
2 changes: 1 addition & 1 deletion congress/metadata/S001205.yaml
@@ -1,2 +1,2 @@
name: U.S. House Office of Photography
link: https://commons.wikimedia.org/w/index.php?curid=79199722
link: https://commons.wikimedia.org/w/index.php?curid=79199722
2 changes: 1 addition & 1 deletion congress/metadata/S001208.yaml
@@ -1,2 +1,2 @@
name: United States Congress
link: https://commons.wikimedia.org/w/index.php?curid=75591621
link: https://commons.wikimedia.org/w/index.php?curid=75591621
4 changes: 2 additions & 2 deletions congress/metadata/S001209.yaml
@@ -1,2 +1,2 @@
name: United States House of Representatives
link: https://commons.wikimedia.org/w/index.php?curid=75552783
name: United States House of Representatives
link: https://commons.wikimedia.org/w/index.php?curid=75552783
2 changes: 1 addition & 1 deletion congress/metadata/S001211.yaml
@@ -1,2 +1,2 @@
name: United States Congress
link: https://commons.wikimedia.org/w/index.php?curid=75644409
link: https://commons.wikimedia.org/w/index.php?curid=75644409

0 comments on commit b5e049e

Please sign in to comment.