Skip to content

Commit

Permalink
Adjust resource name to match the one from default template
Browse files Browse the repository at this point in the history
  • Loading branch information
sultaniman committed May 13, 2024
1 parent bb1896b commit b2de636
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/website/docs/walkthroughs/create-a-pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Below `api_secret_key` [will get its value](../general-usage/credentials/configu
```py
@dlt.source
def githubapi_source(api_secret_key=dlt.secrets.value):
return githubapi_my_repo_issues(api_secret_key=api_secret_key)
return githubapi_resource(api_secret_key=api_secret_key)
```

Run the `githubapi.py` pipeline script to test that authentication headers look fine:
Expand All @@ -82,15 +82,15 @@ Your API key should be printed out to stdout along with some test data.
>[!NOTE]
> We will use dlt as an example project https://github.com/dlt-hub/dlt, feel free to replace it with your own repository.
Modify `githubapi_my_repo_issues` in `githubapi.py` to request issues data from your GitHub project's API:
Modify `githubapi_resource` in `githubapi.py` to request issues data from your GitHub project's API:

```py
from dlt.sources.helpers.rest_client import paginate
from dlt.sources.helpers.rest_client.auth import BearerTokenAuth
from dlt.sources.helpers.rest_client.paginators import HeaderLinkPaginator

@dlt.resource(write_disposition="append")
def githubapi_my_repo_issues(api_secret_key=dlt.secrets.value):
def githubapi_resource(api_secret_key=dlt.secrets.value):
url = "https://api.github.com/repos/dlt-hub/dlt/issues"

for page in paginate(
Expand Down Expand Up @@ -135,7 +135,7 @@ if __name__=='__main__':
)

# print credentials by running the resource
data = list(githubapi_my_repo_issues())
data = list(githubapi_resource())

# print the data yielded from resource
print(data)
Expand Down

0 comments on commit b2de636

Please sign in to comment.