-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
🎉 New Source: Recharge #3466
🎉 New Source: Recharge #3466
Conversation
/test connector=source-recharge
|
/test connector=source-recharge
|
@@ -0,0 +1,7 @@ | |||
* | |||
!Dockerfile | |||
!Dockerfile.test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we still need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
|
||
dependencies { | ||
implementation files(project(':airbyte-integrations:bases:source-acceptance-test').airbyteDocker.outputs) | ||
implementation files(project(':airbyte-integrations:bases:base-python').airbyteDocker.outputs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we don't need this anymore
@@ -0,0 +1,21 @@ | |||
{ | |||
"addresses": { | |||
"created_at": "2024-05-18T00:00:00" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you are not going to be around at that time?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set other dates
from setuptools import find_packages, setup | ||
|
||
MAIN_REQUIREMENTS = [ | ||
"airbyte-cdk", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets pin version, for example ~=0.1
@@ -0,0 +1,27 @@ | |||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one has old header
super().__init__(**kwargs) | ||
self._start_date = pendulum.parse(start_date) | ||
|
||
cursor_field = "created_at" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets keep all class attributes on top of the Class
|
||
def read_records(self, stream_slice: Optional[Mapping[str, Any]] = None, **kwargs) -> Iterable[Mapping[str, Any]]: | ||
owner_resources = ["customer", "store", "subscription"] | ||
for owner in owner_resources: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure that logic that saves state works correctly here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is Not Incremental stream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oopsii
|
||
primary_key = ["shop", "store"] | ||
|
||
def get_stream_data(self, response_data: Any) -> List[dict]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets move this logic inside parent class:
- declare data_path property, default return self.name
- if data_path is not none response_data = response_data.get(self.name, [])
- set data_path to None here
WDYT?
airbyte-integrations/connectors/source-recharge/source_recharge/source.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good in general
/test connector=source-recharge
|
from airbyte_cdk.sources.streams.http import HttpStream | ||
|
||
|
||
class RechargeStream(HttpStream, ABC): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really clean implementation. Well done!
|
||
class RechargeTokenAuthenticator(TokenAuthenticator): | ||
def get_auth_header(self) -> Mapping[str, Any]: | ||
return {"X-Recharge-Access-Token": self._token} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW you can use TokenAuthenticator
and pass the auth header instead of creating a custom authenticator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it but doesn't work in this case. I only need the token
in the value, and if I specify auth_method
as an empty string, then I get the following value:
{"X-Recharge-Access-Token": f" self._token"}
And the requests
library swears for the presence of a space before the token itself.
list(Shop(authenticator=auth).read_records(SyncMode.full_refresh)) | ||
return True, None | ||
except Exception as error: | ||
return False, f"Unable to connect to Recharge API with the provided credentials - {error}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to use repr(error)
|
||
### Performance considerations | ||
|
||
The Recharge connector should not run into Recharge API limitations under normal usage. Please [create an issue](https://github.com/airbytehq/airbyte/issues) if you see any rate limit issues that are not automatically retried successfully. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Recharge connector should not run into Recharge API limitations under normal usage. Please [create an issue](https://github.com/airbytehq/airbyte/issues) if you see any rate limit issues that are not automatically retried successfully. | |
The Recharge connector should gracefully handle Recharge API limitations under normal usage. Please [create an issue](https://github.com/airbytehq/airbyte/issues) if you see any rate limit issues that are not automatically retried successfully. |
/test connector=source-recharge
|
…/new-connector-recharge
/publish connector=connectors/source-recharge
|
What
closes #2308
How
Describe the solution
Pre-merge Checklist
Recommended reading order
schemas.py
streams.py
source.py