-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Klarna [python cdk] #18385
Conversation
let us know when this is ready to review @artusiep |
d77e80f
to
f493657
Compare
Hey @marcosmarxm the first version of source_klarna is ready for review |
Hello @artusiep, Marcos from Airbyte here 👋 . We received more than 25 new contributions along the weekend. One is yours 🎉 thank so much for! Our team is limited and maybe the review process can take longer than expected. As described in the Airbyte's Hacktoberfest your contribution was submitted before November 2nd and it is eligible to win the prize. The review process will validate other requirements. I ask to you patience until someone from the team review it. Because I reviewed some contributions for Hacktoberfest so far I saw some common patterns you can check in advance:
If possible send to me a DM in Slack with the tests credentials, this process will make easier to us run integration tests and publish your connector. If you only has production keys, make sure to create a bootstrap.md explaining how to get the keys. |
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.
Some comments beside my previous comment.
:param config: A Mapping of the user input configuration as defined in the connector spec. | ||
""" | ||
auth = BasicHttpAuthenticator(username=config['username'], password=config['password']) | ||
return [Payouts(authenticator=auth, **config), Transactions(authenticator=auth, **config)] |
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 planning to add others streams besides Payouts and Transactions?
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.
For now I do not
conn_test_stream.page_size = 1 | ||
conn_test_stream.next_page_token = lambda x: None |
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.
Why 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.
I just want to do one http call with size 1 to decrease time needed for checks. It is not possible to pass any argument to the read_records
that would allow me to do so then just monkey_patching method for next_page_token
def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]: | ||
""" | ||
:return an iterable containing each record in the response | ||
""" | ||
transactions = response.json().get("transactions", []) | ||
yield from transactions |
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.
Please create a variable and simplify this to be reusable.
def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]: | |
""" | |
:return an iterable containing each record in the response | |
""" | |
transactions = response.json().get("transactions", []) | |
yield from transactions | |
# move this to KlarnaStream | |
def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapping]: | |
""" | |
:return an iterable containing each record in the response | |
""" | |
records = response.json().get(self.endpoint, []) | |
yield from records |
class Transactions(KlarnaStream):
endpoint = "transactions"
@@ -0,0 +1,30 @@ | |||
documentationUrl: https://docsurl.com |
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.
Correct to: https://docs.airbyte.com/integrations/sources/klarna
if 'pagination' in response_json: | ||
if 'next' in response_json['pagination']: | ||
parsed_url = urlparse(response_json['pagination']['next']) | ||
query_params = parse_qs(parsed_url.query) | ||
# noinspection PyTypeChecker | ||
return query_params | ||
else: | ||
return None |
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.
if 'pagination' in response_json: | |
if 'next' in response_json['pagination']: | |
parsed_url = urlparse(response_json['pagination']['next']) | |
query_params = parse_qs(parsed_url.query) | |
# noinspection PyTypeChecker | |
return query_params | |
else: | |
return None | |
if 'next' in response_json.get('pagination', {}).keys(): | |
parsed_url = urlparse(response_json['pagination']['next']) | |
query_params = parse_qs(parsed_url.query) | |
# noinspection PyTypeChecker | |
return query_params | |
else: | |
return None |
You can simplify the code.
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.
Also add a unit test to validate the function.
|
Hello! I'm going to be out of the office this Friday and won't be able to review your contribution again today, I return next Monday. So far, most contributions look solid and are almost done to be approved. As said in Chris' comment all contributions made before 2-November are eligible to receive the prize and have 2 weeks to merge the contributions. But I ensure next week we're going to have your contribution merged. If you have questions about the implementation you can send them in Sorry the inconvenience and see you again next week, thank you so much for your contribution! |
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.
Thanks @artusiep I'll publish the connector later this week.
/test connector=connectors/source-klarna
Build PassedTest summary info:
|
/publish connector=connectors/source-klarna
if you have connectors that successfully published but failed definition generation, follow step 4 here |
…nent * master: 🪟 🎉 Enable frontend validation for <1hr syncs (cloud) #19028 Stream returns AirbyteMessages (#18572) 🎉 New Source - Recruitee [low-code SDK] (#18671) 🎉 New source: Breezometer [low-code cdk] (#18650) Check disabled connections after protocol update (#18990) Simple default replication worker refactor (#19002) 🎉 New Source: Visma e-conomic (#18595) 🎉 New Source: Fastbill (#18593) Bmoric/extract state api (#18980) 🎉 New Source: Zapier Supported Storage (#18442) 🎉 New source: Klarna (#18385) `AirbyteEstimateTraceMessage` (#18875) Extract source definition api (#18977) [low-code cdk] Allow for spec file to be defined in the yaml manifest instead of an external file (#18411) 🐛 Source HubSpot: fix property scopes (#18624) Ensure that only 6-character hex values are passed to monaco editor (#18943)
What
Added a new source-klarna connector. Now we will be able to use Klarna as a data source.
Changes should not affect frontend
How
Added a new source connector python based
Recommended reading order
y.python
🚨 User Impact 🚨
These changes should not break any existing features of Airbyte.
Pre-merge Checklist
Expand the relevant checklist and delete the others.
New Connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampledocs/integrations/README.md
airbyte-integrations/builds.md
Airbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereUpdating a connector
Community member or Airbyter
airbyte_secret
./gradlew :airbyte-integrations:connectors:<name>:integrationTest
.README.md
bootstrap.md
. See description and examplesdocs/integrations/<source or destination>/<name>.md
including changelog. See changelog exampleAirbyter
If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.
/test connector=connectors/<name>
command is passing/publish
command described hereConnector Generator
-scaffold
in their name) have been updated with the latest scaffold by running./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates
then checking in your changesTests
Unit
Integration
Put your integration tests output here.
Acceptance
Put your acceptance tests output here.