-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into sainte_anne_de_bellevue_scraper
- Loading branch information
Showing
147 changed files
with
1,315 additions
and
1,316 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# The pull_request_target workflow trigger is dangerous. Do not add unrelated logic to this workflow. | ||
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ | ||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target | ||
name: Auto-merge | ||
on: pull_request_target | ||
permissions: | ||
pull-requests: write # to approve the PR | ||
contents: write # to merge the PR | ||
jobs: | ||
dependabot: | ||
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: dependabot-metadata | ||
uses: dependabot/fetch-metadata@v2 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
- if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' || steps.dependabot-metadata.outputs.package-ecosystem == 'github_actions' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh pr review --approve ${{ github.event.pull_request.html_url }} | ||
- if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' || steps.dependabot-metadata.outputs.package-ecosystem == 'github_actions' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh pr merge --auto --squash ${{ github.event.pull_request.html_url }} | ||
precommit: | ||
if: ${{ github.event.pull_request.user.login == 'pre-commit-ci[bot]' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh pr review --approve ${{ github.event.pull_request.html_url }} | ||
- env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh pr merge --auto --squash ${{ github.event.pull_request.html_url }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
ci: | ||
autoupdate_schedule: quarterly | ||
skip: [pip-compile] | ||
default_language_version: | ||
python: python3.10 | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 24.3.0 | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.6.9 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pycqa/flake8 | ||
rev: 7.0.0 | ||
- id: ruff | ||
- id: ruff-format | ||
- repo: https://github.com/astral-sh/uv-pre-commit | ||
rev: 0.4.18 | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: [flake8-comprehensions] | ||
- repo: https://github.com/pycqa/isort | ||
rev: 5.13.2 | ||
hooks: | ||
- id: isort | ||
- id: pip-compile | ||
name: pip-compile requirements.in | ||
args: [requirements.in, -o, requirements.txt] |
This file contains 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 file contains 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 file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,30 @@ | ||
from utils import CSVScraper | ||
from utils import CanadianPerson as Person | ||
from utils import CanadianScraper | ||
|
||
COUNCIL_PAGE = "https://cityofgp.com/city-government/mayor-city-council/council-members" | ||
|
||
class GrandePrairiePersonScraper(CSVScraper): | ||
# https://data.cityofgp.com/Community/City-Council-Contact-Information/vcfc-gi78 | ||
csv_url = "https://data.cityofgp.com/api/views/vcfc-gi78/rows.csv?accessType=DOWNLOAD" | ||
many_posts_per_area = True | ||
|
||
class GrandePrairiePersonScraper(CanadianScraper): | ||
def scrape(self): | ||
seat_number = 1 | ||
page = self.lxmlize(COUNCIL_PAGE) | ||
councillors = page.xpath('//div[contains(@class, "council-bios")]//div[@class="views-row"]') | ||
|
||
assert len(councillors), "No councillors found" | ||
for councillor in councillors: | ||
role, name = councillor.xpath(".//h3")[0].text_content().split(" ", 1) | ||
if role == "Councillor": | ||
district = f"Grande Prairie (seat {seat_number})" | ||
seat_number += 1 | ||
else: | ||
district = " Grande Prairie" | ||
email = self.get_email(councillor) | ||
phone = self.get_phone(councillor) | ||
image = councillor.xpath(".//img/@src")[0] | ||
|
||
p = Person(primary_org="legislature", name=name, district=district, role=role, image=image) | ||
p.add_contact("email", email) | ||
p.add_contact("voice", phone, "legislature") | ||
p.add_source(COUNCIL_PAGE) | ||
|
||
yield p |
This file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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 file contains 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
Oops, something went wrong.