Skip to content

Commit

Permalink
Fixed email encryption error
Browse files Browse the repository at this point in the history
  • Loading branch information
samJMA committed Nov 8, 2024
1 parent f8a69cf commit 6e7c15e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ca_qc_kirkland/people.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,15 @@ def decode_email(e):
.replace(".", ",")
.replace(",-#-", " x")
)
encrypted_email = councillor.xpath('.//@href[contains(., "email")]')[0].split("#")[1]
email = decode_email(encrypted_email)

# cloudflare encrypts the email data
email = councillor.xpath(".//div/*/*/@href | .//div/*/@href | .//@href")[0]
decoded_email = decode_email(email.split("#", 1)[1])
encrypted_email = councillor.xpath('.//@href[contains(., "email")]')[0]
email = self._cloudflare_decode(encrypted_email)

p = Person(primary_org="legislature", name=name, district=district, role=role)
p.add_source(COUNCIL_PAGE)
p.add_contact("voice", phone, "legislature")
p.add_contact("email", decoded_email)
p.add_contact("email", email)
image = councillor.xpath(".//img/@src")
if image:
p.image = image[0]
Expand Down

0 comments on commit 6e7c15e

Please sign in to comment.