Skip to content

Commit

Permalink
Enable ssl verification again
Browse files Browse the repository at this point in the history
  • Loading branch information
j4asper committed Jul 27, 2022
1 parent 6d6406e commit f2df262
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions dmr/utils/async_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
async def scrape_async(license_plate:str):
async def get_token(session):
"""Get dmrFormToken"""
async with session.get("https://motorregister.skat.dk/dmr-kerne/koeretoejdetaljer/visKoeretoej", headers=get_headers(), allow_redirects=True, ssl=False) as resp:
async with session.get("https://motorregister.skat.dk/dmr-kerne/koeretoejdetaljer/visKoeretoej", headers=get_headers(), allow_redirects=True) as resp:
content = await resp.text()
source = fromstring(content)
try:
Expand All @@ -28,7 +28,7 @@ async def get_token(session):
new_url: "Søg"
}

async with session.post('https://motorregister.skat.dk' + new_url, data=payload, headers=get_headers({"Referer":"https://motorregister.skat.dk" + new_url}), allow_redirects=True, ssl=False) as resp:
async with session.post('https://motorregister.skat.dk' + new_url, data=payload, headers=get_headers({"Referer":"https://motorregister.skat.dk" + new_url}), allow_redirects=True) as resp:
content = await resp.text()

if "Ingen køretøjer fundet." in content:
Expand All @@ -40,7 +40,7 @@ async def get_token(session):
data = page_1(source)
second_page = source.xpath('/html/body/div[2]/div/div[1]/div[2]/div[3]/div/div[1]/ul/li[2]/div/a')[0].get("href")

async with session.get("https://motorregister.skat.dk" + second_page, headers=get_headers({"Referer":"https://motorregister.skat.dk" + new_url[:-16]}), allow_redirects=True, ssl=False) as resp:
async with session.get("https://motorregister.skat.dk" + second_page, headers=get_headers({"Referer":"https://motorregister.skat.dk" + new_url[:-16]}), allow_redirects=True) as resp:
content = await resp.text()

source = fromstring(content)
Expand Down
6 changes: 3 additions & 3 deletions dmr/utils/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def scrape(license_plate:str):
def get_token(session):
"""Get dmrFormToken"""
resp = session.get("https://motorregister.skat.dk/dmr-kerne/koeretoejdetaljer/visKoeretoej", headers=get_headers(), allow_redirects=True, verify=False)
resp = session.get("https://motorregister.skat.dk/dmr-kerne/koeretoejdetaljer/visKoeretoej", headers=get_headers(), allow_redirects=True)
source = fromstring(resp.text)
try:
token = source.xpath('/html/body/div[2]/div/div[1]/div[2]/form/input')[0].get("value")
Expand All @@ -27,7 +27,7 @@ def get_token(session):
new_url: "Søg"
}

resp = session.post('https://motorregister.skat.dk' + new_url, data=payload, headers=get_headers({"Referer":"https://motorregister.skat.dk" + new_url}), allow_redirects=True, verify=False)
resp = session.post('https://motorregister.skat.dk' + new_url, data=payload, headers=get_headers({"Referer":"https://motorregister.skat.dk" + new_url}), allow_redirects=True)

if "Ingen køretøjer fundet." in resp.text:
# Licens plate doesn't exist
Expand All @@ -38,7 +38,7 @@ def get_token(session):

second_page = source.xpath('/html/body/div[2]/div/div[1]/div[2]/div[3]/div/div[1]/ul/li[2]/div/a')[0].get("href")

resp = session.get("https://motorregister.skat.dk" + second_page, headers=get_headers({"Referer":"https://motorregister.skat.dk" + new_url[:-16]}), allow_redirects=True, verify=False)
resp = session.get("https://motorregister.skat.dk" + second_page, headers=get_headers({"Referer":"https://motorregister.skat.dk" + new_url[:-16]}), allow_redirects=True)

source = fromstring(resp.text)
data.update(page_2(source))
Expand Down

0 comments on commit f2df262

Please sign in to comment.