Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch transaction details #21

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions tap_restaurant365/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,32 @@

from __future__ import annotations

from pathlib import Path
from typing import Any, Callable, Iterable, Optional
from datetime import timedelta, datetime
from dateutil import parser

from datetime import timedelta
from http import HTTPStatus
from typing import Any, Callable

import requests
from dateutil import parser
from singer_sdk.authenticators import BasicAuthenticator
from singer_sdk.helpers.jsonpath import extract_jsonpath
from singer_sdk.exceptions import FatalAPIError, RetriableAPIError
from singer_sdk.pagination import BaseAPIPaginator # noqa: TCH002
from singer_sdk.streams import RESTStream
from singer_sdk.exceptions import FatalAPIError, RetriableAPIError
from http import HTTPStatus

_Auth = Callable[[requests.PreparedRequest], requests.PreparedRequest]


class Restaurant365Stream(RESTStream):
"""Restaurant365 stream class."""

skip = 0
days_delta = 10

@property
def url_base(self) -> str:
"""Return the API URL root, configurable via tap settings."""
return "https://odata.restaurant365.net/api/v2/views"

records_jsonpath = "$.value[*]"

records_jsonpath = "$.value[*]"

@property
def authenticator(self) -> BasicAuthenticator:
Expand Down Expand Up @@ -62,9 +61,7 @@ def get_new_paginator(self) -> BaseAPIPaginator:
# else:
# params


return super().get_new_paginator()


def get_starting_time(self, context):
start_date = self.config.get("start_date")
Expand All @@ -90,11 +87,11 @@ def get_url_params(

params: dict = {}
if self.replication_key:
start_date = self.get_starting_time(context).strftime('%Y-%m-%dT%H:%M:%SZ')
start_date = self.get_starting_time(context).strftime("%Y-%m-%dT%H:%M:%SZ")
params["$filter"] = f"{self.replication_key} ge {start_date}"

return params

def validate_response(self, response: requests.Response) -> None:
if (
response.status_code in self.extra_retry_statuses
Expand Down
Loading
Loading