-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
update python cdk tutorial with updates to exchange rates api #12427
Conversation
@@ -14,14 +14,16 @@ | |||
|
|||
|
|||
class ExchangeRates(HttpStream): | |||
url_base = "https://api.exchangeratesapi.io/" | |||
url_base = "http://api.exchangeratesapi.io/" |
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.
Exchange Rates only allows free tier to use http not https
# The api requires that we include the base currency as a query param so we do that in this method | ||
return {'base': self.base} | ||
# The api requires that we include access_key as a query param so we do that in this method | ||
return {'access_key': self.access_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.
Free tier users no longer have the ability to specify a base. Leaving it in results in 400 errors. Although its confusing from a tutorial standpoint to allow for base, base is used in earlier sections to demonstrate invalid configs so I think we should not completely remove it from the tutorial since it still serves a purpose, even if not in the outbound req
@@ -38,8 +40,8 @@ def request_params( | |||
stream_slice: Mapping[str, Any] = None, | |||
next_page_token: Mapping[str, Any] = None, | |||
) -> MutableMapping[str, Any]: | |||
# The api requires that we include the base currency as a query param so we do that in this method | |||
return {"base": self.base} | |||
# The api requires that we include access_key as a query param so we do that in this method ADD 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.
the ADD THIS
. comment is a little confusing. what needs to be added?
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.
nice catch! I forgot to delete that as i was marking what code to add to the tutorial. will delete this
* update python cdk tutorial with updates to exchange rates api * remove extra comment in source.py tutorial sample code
Issue: #12249
What
The Exchange Rates API that we use as part of the "Python CDK: Creating a HTTP API Source" tutorial has changed quite a bit in the past few months. In particular, the introduction of required API access keys and some new limitations on what Free tier users can utilize has made out instructions fall out of sync.
How
Most of the changes to the API can all be reasoned about with some experimentation, but in order to reduce the friction of people going through the tutorial, I've updated the steps and code snippets to incorporate changes to the API. I've also updated some of the connector code to align with the new changes.