Skip to content

Commit

Permalink
Formatted with black
Browse files Browse the repository at this point in the history
  • Loading branch information
Re-st committed Nov 8, 2023
1 parent a3648d6 commit b31c676
Show file tree
Hide file tree
Showing 14 changed files with 197 additions and 258 deletions.
3 changes: 2 additions & 1 deletion scrap/local_councils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
from scrap.utils.types import CouncilType
from scrap.utils.utils import getPartyList


def returncouncilors(cid, councilors):
return ScrapResult(
council_id=cid,
council_type=CouncilType.LOCAL_COUNCIL,
councilors=councilors,
)
)
2 changes: 2 additions & 0 deletions scrap/local_councils/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
party_keywords = getPartyList()
party_keywords.append("무소속")


def find(soup, element, class_):
if class_ is None:
return soup.find(element)
Expand Down Expand Up @@ -141,6 +142,7 @@ def get_party_easy(profile, wrapper_element, wrapper_class_, wrapper_txt, url):
assert party is not None
return party


def scrap_basic(url, cid, args: ScrapBasicArgument, encoding="utf-8") -> ScrapResult:
"""의원 상세약력 스크랩
:param url: 의원 목록 사이트 url
Expand Down
51 changes: 16 additions & 35 deletions scrap/local_councils/busan.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
from scrap.local_councils import *
from scrap.local_councils.basic import returncouncilors

def scrap_26(
url, cid
) -> ScrapResult:

def scrap_26(url, cid) -> ScrapResult:
"""부산 중구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []
Expand All @@ -28,10 +27,8 @@ def scrap_26(

return returncouncilors(cid, councilors)

def scrap_27(
url,
cid
) -> ScrapResult:

def scrap_27(url, cid) -> ScrapResult:
"""부산 서구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []
Expand Down Expand Up @@ -60,9 +57,7 @@ def scrap_27(
returncouncilors(cid, councilors)


def scrap_28(
url, cid
) -> ScrapResult:
def scrap_28(url, cid) -> ScrapResult:
"""부산 동구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []
Expand Down Expand Up @@ -102,9 +97,7 @@ def scrap_29(url, cid) -> ScrapResult:
return returncouncilors(cid, councilors)


def scrap_30(
url, cid
) -> ScrapResult:
def scrap_30(url, cid) -> ScrapResult:
"""부산 부산진구"""
soup = get_soup(url, verify=False).find("ul", class_="mlist")
councilors: list[Councilor] = []
Expand All @@ -125,9 +118,7 @@ def scrap_30(
return returncouncilors(cid, councilors)


def scrap_31(
url, cid
) -> ScrapResult:
def scrap_31(url, cid) -> ScrapResult:
"""부산 동래구"""
soup = get_soup(url, verify=False, encoding="euc-kr")
councilors: list[Councilor] = []
Expand Down Expand Up @@ -169,8 +160,7 @@ def scrap_32(url, cid) -> ScrapResult:
return returncouncilors(cid, councilors)


def scrap_33(
url, cid) -> ScrapResult:
def scrap_33(url, cid) -> ScrapResult:
"""부산 북구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []
Expand All @@ -189,8 +179,7 @@ def scrap_33(
return returncouncilors(cid, councilors)


def scrap_34(
url, cid) -> ScrapResult:
def scrap_34(url, cid) -> ScrapResult:
"""부산 해운대구"""
soup = get_soup(url, verify=False).find("div", class_="initial_list")
councilors: list[Councilor] = []
Expand All @@ -217,8 +206,7 @@ def scrap_34(
return returncouncilors(cid, councilors)


def scrap_35(
url, cid) -> ScrapResult:
def scrap_35(url, cid) -> ScrapResult:
"""부산 기장군"""
soup = get_soup(url, verify=False, encoding="euc-kr")
councilors: list[Councilor] = []
Expand All @@ -239,8 +227,7 @@ def scrap_35(
return returncouncilors(cid, councilors)


def scrap_36(
url, cid) -> ScrapResult:
def scrap_36(url, cid) -> ScrapResult:
"""부산 사하구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []
Expand All @@ -259,8 +246,7 @@ def scrap_36(
return returncouncilors(cid, councilors)


def scrap_37(
url, cid) -> ScrapResult:
def scrap_37(url, cid) -> ScrapResult:
"""부산 금정구"""
soup = get_soup(url, verify=False).find("div", class_="council_list")
councilors: list[Councilor] = []
Expand All @@ -281,8 +267,7 @@ def scrap_37(
return returncouncilors(cid, councilors)


def scrap_38(
url, cid) -> ScrapResult:
def scrap_38(url, cid) -> ScrapResult:
"""부산 강서구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []
Expand All @@ -305,8 +290,7 @@ def scrap_38(
return returncouncilors(cid, councilors)


def scrap_39(
url, cid) -> ScrapResult:
def scrap_39(url, cid) -> ScrapResult:
"""부산 연제구"""
councilors: list[Councilor] = []

Expand Down Expand Up @@ -338,8 +322,7 @@ def scrap_39(
return returncouncilors(cid, councilors)


def scrap_40(
url, cid) -> ScrapResult:
def scrap_40(url, cid) -> ScrapResult:
"""부산 수영구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []
Expand All @@ -358,9 +341,7 @@ def scrap_40(
return returncouncilors(cid, councilors)


def scrap_41(
url, cid
) -> ScrapResult:
def scrap_41(url, cid) -> ScrapResult:
"""부산 사상구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []
Expand Down
28 changes: 17 additions & 11 deletions scrap/local_councils/chungcheong.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from scrap.local_councils import *
from scrap.local_councils.basic import *


def scrap_124(
url, cid,
url,
cid,
args: ScrapBasicArgument = None,
) -> ScrapResult:
"""충청북도 청주시 페이지에서 의원 상세약력 스크랩
Expand Down Expand Up @@ -32,7 +34,9 @@ def scrap_124(


def scrap_125(
url, cid, args: ScrapBasicArgument = None,
url,
cid,
args: ScrapBasicArgument = None,
) -> ScrapResult:
"""충청북도 충주시 페이지에서 의원 상세약력 스크랩
Expand Down Expand Up @@ -60,7 +64,9 @@ def scrap_125(


def scrap_126(
url, cid, args: ScrapBasicArgument = None,
url,
cid,
args: ScrapBasicArgument = None,
) -> ScrapResult:
"""충청북도 제천시 페이지에서 의원 상세약력 스크랩
Expand All @@ -87,7 +93,9 @@ def scrap_126(


def scrap_132(
url, cid, args: ScrapBasicArgument = None,
url,
cid,
args: ScrapBasicArgument = None,
) -> ScrapResult:
"""충청북도 제천시 페이지에서 의원 상세약력 스크랩
Expand Down Expand Up @@ -115,7 +123,9 @@ def scrap_132(


def scrap_134(
url, cid, args: ScrapBasicArgument = None,
url,
cid,
args: ScrapBasicArgument = None,
) -> ScrapResult:
"""충청북도 증평군 페이지에서 의원 상세약력 스크랩
Expand Down Expand Up @@ -143,9 +153,7 @@ def scrap_134(
return returncouncilors(cid, councilors)


def scrap_140(
url, cid, args: ScrapBasicArgument = None
) -> ScrapResult:
def scrap_140(url, cid, args: ScrapBasicArgument = None) -> ScrapResult:
"""충청남도 태안군 페이지에서 의원 상세약력 스크랩
:param url: 의원 목록 사이트 url
Expand All @@ -168,9 +176,7 @@ def scrap_140(
return returncouncilors(cid, councilors)


def scrap_142(
url, cid, args
) -> ScrapResult:
def scrap_142(url, cid, args) -> ScrapResult:
"""충청남도 논산시"""
base_url = "https://www.nonsancl.go.kr/kr/member/profile_popup?uid="
soup = get_soup(url)
Expand Down
40 changes: 14 additions & 26 deletions scrap/local_councils/daegu.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from scrap.local_councils import *

def scrap_42(
url, cid) -> ScrapResult:

def scrap_42(url, cid) -> ScrapResult:
"""대구 중구"""
soup = get_soup(url, verify=False, encoding="euc-kr")
councilors: list[Councilor] = []
Expand All @@ -22,10 +22,8 @@ def scrap_42(
return returncouncilors(cid, councilors)


def scrap_43(
url, cid) -> ScrapResult:
"""대구 동구
"""
def scrap_43(url, cid) -> ScrapResult:
"""대구 동구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []

Expand Down Expand Up @@ -56,8 +54,7 @@ def scrap_43(


def scrap_44(url, cid) -> ScrapResult:
"""대구 서구
"""
"""대구 서구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []

Expand All @@ -79,10 +76,8 @@ def scrap_44(url, cid) -> ScrapResult:
return returncouncilors(cid, councilors)


def scrap_45(
url, cid) -> ScrapResult:
"""대구 남구
"""
def scrap_45(url, cid) -> ScrapResult:
"""대구 남구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []

Expand All @@ -103,8 +98,7 @@ def scrap_45(


def scrap_46(url, cid) -> ScrapResult:
"""대구 북구
"""
"""대구 북구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []

Expand All @@ -124,10 +118,8 @@ def scrap_46(url, cid) -> ScrapResult:
return returncouncilors(cid, councilors)


def scrap_47(
url, cid) -> ScrapResult:
"""대구 수성구
"""
def scrap_47(url, cid) -> ScrapResult:
"""대구 수성구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []

Expand All @@ -145,10 +137,8 @@ def scrap_47(
return returncouncilors(cid, councilors)


def scrap_48(
url, cid) -> ScrapResult:
"""대구 달서구
"""
def scrap_48(url, cid) -> ScrapResult:
"""대구 달서구"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []

Expand All @@ -169,10 +159,8 @@ def scrap_48(
return returncouncilors(cid, councilors)


def scrap_49(
url, cid) -> ScrapResult:
"""대구 달성군
"""
def scrap_49(url, cid) -> ScrapResult:
"""대구 달성군"""
soup = get_soup(url, verify=False)
councilors: list[Councilor] = []

Expand Down
Loading

0 comments on commit b31c676

Please sign in to comment.