-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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: Newsdata [low-code CDK] #18576
Conversation
{
"api_key": "XXX",
"country": ["fr"],
"category": ["health"],
"language": ["en"]
} |
Thanks for the contribution @Xabilahu ! |
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.
airbyte-integrations/connectors/source-newsdata/source_newsdata/spec.yaml
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-newsdata/source_newsdata/spec.yaml
Outdated
Show resolved
Hide resolved
airbyte-integrations/connectors/source-newsdata/source_newsdata/spec.yaml
Show resolved
Hide resolved
paginator: | ||
type: NoPagination |
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.
@Xabilahu can you check the pagination for this connector?
type: "CursorPagination" | ||
cursor_value: "{{ response['nextPage'] }}" | ||
page_size: 10 | ||
# page_size: !!int "{% if config['is_free_tier'] %}{{ 10 }}{% else %}{{ 50 }}{% endif %}" |
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 API sets the page_size
dependent on the subscription you have.
- Free tier gets
page_size = 10
- Any paid tier gets
page_size = 50
The jinja interpolation works, but in this case, as it interpolates after !!int
is executed, it fails to convert the string to an int. We need to cast it to int, as it is the type of page_size
property. Any hint?
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.
@girarda any advice 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.
I would suggest setting the page_size in the spec instead of the is_free_tier field. I'll create an issue for the pagination strategy to handle dynamic page_size
issue: https://github.com/airbytehq/airbyte/issues/18783
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.
@girarda, but wouldn't we still need string interpolation if handled in the spec?
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.
yes, you're right. There's no way to dynamically set the page size today
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.
Okey, so for now I will remove is_free_tier
from spec.yaml
, and set the page_size = 10
, so that this connector works for both, free and paid tiers.
We will leave the dynamic page_size
for a follow up.
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.
@Xabilahu agree.
base_requester: | ||
url_base: "https://newsdata.io/api/1" | ||
http_method: "GET" | ||
authenticator: | ||
type: ApiKeyAuthenticator | ||
header: "X-ACCESS-KEY" | ||
api_token: "{{ config['api_key'] }}" |
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.
From the API documentation:
To obtain an API key you have to create an account. You get a free API key while you are in development. When making REST API requests, your API key has to be provided as a parameter in the URL (e.g. apikey=YOUR_API_KEY).
I tried to read data but no records were read.
{"type": "LOG", "log": {"level": "INFO", "message": "Read 0 records from latest 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.
Please check the authentication.
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 the request would not have been authenticated, you would have gotten a 401 - Unauthorized response.
From Newsdata API documentation:
Your Newsdata.io API Key. Alternatively you can provide this via the X-ACCESS-KEY HTTP header.
Could you share your config.json
?
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.
@Xabilahu reading the API documentation I saw one endpoint News Archive
where you can read all news from a specific date. This can be really valuable to users and you can implement a Incremental sync.
After taking a look, I remembered why I didn't implement support for that endpoint. It is because it is only accessible to paid tiers, which I don't have access to, and I wouldn't be able to test my implementation :( Same happens for the Should I implement them anyways? |
Not a problem! |
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 @Xabilahu I'll publish later this week.
Hello! Your PR is approved but didn't have the time to publish and merge it this week. As you can check in Chris' comment all PRs submitted before 2-nov are eligible to win the prize. I'll be out of the office on Friday and return Monday to start publishing your contribution. Any question you can send a message in Have a good weekend and thank you for this amazing contribution for Hacktoberfest 🎉 |
More than happy to contribute ❤️ Have a nice weekend! 🥳 |
/test connector=connectors/source-newsdata
Build PassedTest summary info:
|
/publish connector=connectors/source-newsdata
if you have connectors that successfully published but failed definition generation, follow step 4 here |
Thanks for all the help @marcosmarxm 🥳😁 |
* Initial Newsdata source connector implementation * Update docs, source_definitions and upload icon * Set single input for `sources` stream * Remove unused definition * Update `spec.yaml` config * Support Pagination * Remove `is_free_tier`, because as of now, dynamic `page_size` is not supported * auto-bump connector version Co-authored-by: Octavia Squidington III <[email protected]> Co-authored-by: Marcos Marx <[email protected]>
What
New Source: Newsdata API. newsdata.io
Notes
I'm using a free API key, click here to get one for CI integration tests.
🚨 User Impact 🚨
Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.
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
Put your unit tests output here.
Integration
Put your integration tests output here.
Acceptance