Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[c] Fix cron tasks #1051

Merged
merged 4 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/archive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ jobs:
sudo openvpn --config /etc/openvpn/ovpn.conf --daemon
sleep 120

- name: Set up Python 3.7
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.7
python-version: 3.9

- name: Install Pipenv
uses: dschep/install-pipenv-action@v1

- name: Install dependencies
run: pipenv sync
env:
PIPENV_DEFAULT_PYTHON_VERSION: 3.7
PIPENV_DEFAULT_PYTHON_VERSION: 3.9

- name: Run scrapers
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- name: Check imports with isort
run: pipenv run isort . --check-only

- name: Check style with black
run: pipenv run black . --check

- name: Lint with flake8
run: pipenv run flake8 .

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ jobs:
sudo openvpn --config /etc/openvpn/ovpn.conf --daemon
sleep 120

- name: Set up Python 3.7
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.7
python-version: 3.9

- name: Install Pipenv
uses: dschep/install-pipenv-action@v1

- name: Install dependencies
run: pipenv sync
env:
PIPENV_DEFAULT_PYTHON_VERSION: 3.7
PIPENV_DEFAULT_PYTHON_VERSION: 3.9

- name: Run scrapers
run: |
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ python-dateutil = "*"
pytz = "*"
requests = "*"
scrapy = "*"
scrapy-sentry = "*"
scrapy-sentry = {ref = "v1", git = "https://github.com/City-Bureau/scrapy-sentry.git"}
scrapy-wayback-middleware = "*"
city-scrapers-core = {ref = "main", git = "https://github.com/City-Bureau/city-scrapers-core.git", extras = ["azure"]}
pypiwin32 = {version = "*",sys_platform = "== 'win32'"}
Expand Down
855 changes: 476 additions & 379 deletions Pipfile.lock

Large diffs are not rendered by default.

10 changes: 1 addition & 9 deletions city_scrapers/spiders/chi_citycouncil.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import requests
from city_scrapers_core.constants import NOT_CLASSIFIED
from city_scrapers_core.items import Meeting
from city_scrapers_core.spiders import CityScrapersSpider
Expand All @@ -9,19 +8,12 @@ class ChiCitycouncilSpider(CityScrapersSpider):
name = "chi_citycouncil"
agency = "Chicago City Council"
timezone = "America/Chicago"
start_urls = ["https://chicityclerkelms.chicago.gov/Meetings/"]
start_urls = ["https://api.chicityclerkelms.chicago.gov/meeting"]

def parse(self, response):

# The API endpoint
url = "https://api.chicityclerkelms.chicago.gov/meeting" # noqa

# A GET request to the API
response = requests.get(url)
response_json = response.json()

for item in response_json["data"]:

meeting = Meeting(
title=self._parse_title(item),
description=self._parse_description(item),
Expand Down
6 changes: 3 additions & 3 deletions city_scrapers/spiders/chi_midway_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def parse(self, response):
yield from meeting_list

def _parse_title(self, item):
if type(item) == Selector:
if isinstance(item, Selector):
item = item.get()
text = self._clean_bad_chars(item)
desc = ""
Expand All @@ -113,7 +113,7 @@ def _parse_start(self, item):

def _parse_date(self, item):
"""Parse the meeting date."""
if type(item) == Selector:
if isinstance(item, Selector):
# Scheduled meetings have only text; past meetings have <td> tags.
if "<td>" in item.get():
item = item.xpath(".//td/text()").get()
Expand All @@ -135,7 +135,7 @@ def _parse_date(self, item):
def _parse_links(self, item, response):
"""Parse or generate links."""
documents = []
if type(item) == Selector:
if isinstance(item, Selector):
relative_urls = item.xpath(".//a/@href").extract()
for relative_url in relative_urls:
documents.append(self._build_link_dict(response.urljoin(relative_url)))
Expand Down
Loading
Loading