Skip to content

Commit

Permalink
Merge pull request #400 from FliesWithWind/master
Browse files Browse the repository at this point in the history
Fix for request returning no data for warszawa19115
  • Loading branch information
mampfes authored Oct 20, 2022
2 parents ebd182d + 471af3d commit e3a215e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SourceParseError(ValueError):
OC_PARAMS = {
"p_p_id": "portalCKMjunkschedules_WAR_portalCKMjunkschedulesportlet_INSTANCE_o5AIb2mimbRJ",
"p_p_lifecycle": "2",
"p_p_resource_id": "",
"p_p_resource_id": "ajaxResource",
}
OC_HEADERS = {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
Expand Down Expand Up @@ -59,7 +59,7 @@ def get_geolocation_id(self, street_address) -> str:
geolocation_request.raise_for_status()

# Geolocation call requires 'autocompleteResourceURL' param to work
OC_PARAMS["p_p_resource_id"] = "autocompleteResourceURL"
OC_PARAMS["p_p_resource_id"] = "autocompleteResource"

# Search for geolocation ID
payload = f"_{OC_PARAMS['p_p_id']}_name={street_address}"
Expand Down Expand Up @@ -95,14 +95,14 @@ def fetch(self):
# When only an address is specified, get geolocation on first fetch
if self._geolocation_id is None:
self._geolocation_id = self.get_geolocation_id(self._street_address)

# Calendar lookup cares about a cookie, so a Session must be used
calendar_session = requests.Session()
calendar_request = calendar_session.get(OC_URL)
calendar_request.raise_for_status()

# Calendar call requires 'ajaxResourceURL' param to work
OC_PARAMS["p_p_resource_id"] = "ajaxResourceURL"
OC_PARAMS["p_p_resource_id"] = "ajaxResource"

payload = f"_{OC_PARAMS['p_p_id']}_addressPointId={str(self._geolocation_id)}"
calendar_request = calendar_session.post(
Expand Down

0 comments on commit e3a215e

Please sign in to comment.