Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async def generate_code(x, y):
- x += 1.1
- y += 2.3
- timestamp = str(int(time.time() * 1000))
- x_integer = str(x).split(".")[0]
- x_last_digit = x_integer[-1]
- x_first_decimal = str(x).split(".")[1][0] if len(str(x).split(".")) > 1 else "0"
- y_integer = str(y).split(".")[0]
- y_last_digit = y_integer[-1]
- y_first_decimal = str(y).split(".")[1][0] if len(str(y).split(".")) > 1 else "0"
- result_string = x_last_digit + timestamp[-1] + y_last_digit + timestamp[-2] + x_first_decimal + timestamp[-3] + y_first_decimal
- encoded = base64.b64encode(result_string.encode()).decode()
- return encoded
- async def fetch_physicians_data(lat, lon, req_value):
- url = "https://arztsuche.116117.de/api/data"
- headers = {
- "Cache-Control": "no-cache, no-store, max-age=0, must-revalidate",
- "Connection": "keep-alive",
- "Content-Type": "application/json",
- "Accept": "application/json, text/plain, */*",
- "Accept-Encoding": "gzip, deflate, br, zstd",
- "Accept-Language": "en-US,en;q=0.5",
- "Authorization": "Basic YmRwczpma3I0OTNtdmdfZg==",
- "Cookie": "TS013407f0=0111b4ea971c14c0852f62849de60ae01614d47c1f13b104220dc02c8631752eba5f5753d132c30f3dcb7448ad73e959f70bcb6b6e3c754a693b3967489be8577193d248dd; cookieConsent=level1; JSESSIONID=D22DE6C614093EC68869A9B07060FABE",
- "Host": "arztsuche.116117.de",
- "Origin": "https://arztsuche.116117.de",
- "Referer": "https://arztsuche.116117.de/",
- "Sec-Fetch-Dest": "empty",
- "Sec-Fetch-Mode": "cors",
- "Sec-Fetch-Site": "same-origin",
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:136.0) Gecko/20100101 Firefox/136.0",
- "req-val": req_value,
- "Priority": "u=0"
- }
- payload = {
- "r": 900,
- "lat": lat,
- "lon": lon,
- "filterSelections": [
- {
- "title": "Fachgebiet Kategorie",
- "fieldName": "fgg",
- "selectedCodes": ["03"]
- }
- ],
- "locOrigin": req_value,
- "initialSearch": True,
- "viaDeeplink": False
- }
- response = requests.post(url, json=payload, headers = headers, impersonate='chrome')
- return response.json()
- async def main():
- lat = 48.37204385
- lon = 10.89391765
- req_value = await generate_code(lon, lat)
- return await fetch_physicians_data(lat, lon, req_value)
- if __name__ == '__main__':
- start_time = time.time()
- results = asyncio.run(main())
- print(results)
- end_time = time.time()
- execution_time = round(end_time - start_time, 2)
- print(f"Took {execution_time} seconds | {round(execution_time / 60, 2)} minutes.")
Add Comment
Please, Sign In to add comment