http

zipcode_coordinates_tz.http.get_and_download_file(session: requests.AsyncSession, url: str) → AsyncIterator[Path]

Downloads a file from the specified url and returns the Path.

Parameters:
  • session (requests.AsyncSession) – The Session.

  • url (str) – The url to the file to download.

Returns:

An Iterator that contains the Path to the downloaded file.

zipcode_coordinates_tz.http.get_json(session: requests.AsyncSession, url: str, params: dict[str, Any] | None = None) → AsyncIterator[dict[str, Any]]

Executes a get request returning a json payload

Parameters:
  • session (requests.AsyncSession) – The Session.

  • url (str) – The URL to request.

  • params (dict[str, Any] | None) – Optional query parameters.

Returns:

An Iterator that contains the json payload.

zipcode_coordinates_tz.http.post_and_download_file(session: requests.AsyncSession, url: str, params: dict[str, Any], mp: curl_cffi.CurlMime) → AsyncIterator[Path]

POSTs a multipart form and downloads the response body to a temporary file.

Parameters:
  • session (requests.AsyncSession) – The Session.

  • url (str) – The URL to POST to.

  • params (dict[str, Any]) – Query parameters to include in the request.

  • mp (curl_cffi.CurlMime) – The multipart form data to send.

Returns:

An Iterator that contains the Path to the downloaded file.