-
Notifications
You must be signed in to change notification settings - Fork 4.6k
🎉 Source Gitlab: Ingest All Accessible Groups #11140
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
Merged
marcosmarxm
merged 9 commits into
airbytehq:master
from
adamschmidt:adamschmidt/11128-gitlab-soure-groups
Mar 23, 2022
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7d930f6
Use Groups API as default when group/project ids not supplied
adamschmidt 2ebdd67
Gitlab doc update
adamschmidt 0ed442d
Gitlab doc update, fix UX typo
adamschmidt b5c6b3d
review refactor
adamschmidt b31e253
remove test output
adamschmidt 5af7ff1
Merge branch 'adamschmidt/11128-gitlab-soure-groups' of github.com:ad…
marcosmarxm 6786b24
small fixes
marcosmarxm 1ee21f7
bump conenctor version and update docs
marcosmarxm 9442388
Merge branch 'master' into marcos/test-pr-11140
marcosmarxm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
airbyte-integrations/connectors/source-gitlab/source_gitlab/util.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,21 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import requests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
def get_group_list(**kwargs): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
headers = kwargs["authenticator"].get_auth_header() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ids = [] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
r = requests.get(f'https://{kwargs["api_url"]}/api/v4/groups?page=1&per_page=50', headers=headers) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
results = r.json() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
items = map(lambda i: i['full_path'].replace('/', '%2f'), results) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ids.extend(items) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
while 'X-Next-Page' in r.headers and r.headers['X-Next-Page'] != '': | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
next_page = r.headers['X-Next-Page'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
per_page = r.headers['X-Per-Page'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
r = requests.get(f'https://{kwargs["api_url"]}/api/v4/groups?page={next_page}&per_page={per_page}', headers=headers) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
results = r.json() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
items = map(lambda i: i['full_path'].replace('/', '%2f'), results) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ids.extend(items) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return ids | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactored. This was admittedly messy :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 function is only used by the Source class, maybe transfer it to inside the class or let inside the source.py file. Don't see a separate file is helping 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.
Moved to an internal class method on the source