Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

how to get the file content in subdirectory?#2650

Answeredbynejch
supler asked this question inQ&A
Discussion options

it will return 404 error using the below codes

with gitlab.Gitlab(url=GITLAB_URL, private_token=TOKEN) as gl:    p = gl.projects.get(4)    pom_file = p.files.get(file_path='lal-parent/pom.xml', ref=branch_name)

git likes as the below

lal-imp/
xx
lal-parent/pom.xml --------this is the file I wanted
pom.xml

You must be logged in to vote
Answered by nejchAug 25, 2023

@supler this should actually work. So this file either does not exist on the branch you're looking for, or you have some other issue like potentially fetching the wrong project, file path, branch etc.

Replies: 1 comment 5 replies

Comment options

@supler this should actually work. So this file either does not exist on the branch you're looking for, or you have some other issue like potentially fetching the wrong project, file path, branch etc.

You must be logged in to vote
5 replies
@supler
Comment options

but I always get error as the below

gitlab.exceptions.GitlabListError: 404: 404 Not Found

@metaloid2k21
Comment options

same exact issue here :( still didn't find a plausible solution

@JohnVillalovos
Comment options

Will need more details.

Also you might try doing:
gl.enable_debug() to see what is being sent to the GitLab server.

Also helpful to look at the upstream docs:
https://docs.gitlab.com/ee/api/repository_files.html#get-file-from-repository

@metaloid2k21
Comment options

After activating the debug mode on the GitLab object instance, I was able to identify the the wrongly passed parameters.
It's now working as expected.
Tks for the hint 👍

@JohnVillalovos
Comment options

After activating the debug mode on the GitLab object instance, I was able to identify the the wrongly passed parameters. It's now working as expected. Tks for the hint 👍

Great to hear!

Answer selected byJohnVillalovos
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
4 participants
@supler@JohnVillalovos@nejch@metaloid2k21

[8]ページ先頭

©2009-2025 Movatter.jp