Raw URL works in browser but not programmatically


#1

I have a locally installed gitea instance. It has a ‘gflorent’ user that has 1 repo: ‘test-repo’. In this repo, on master, I have a file ‘as1_pe_203.stp’.
In a browser, the url http://localhost:3000/gflorent/test-repo/raw/branch/master/as1_pe_203.stp has the file contents displayed without problem.
But if I try to get the file contents from a program (Python requests, subprocess call to wget, or even wget from command line …), I always face a 404 error.
Are there some settings in Gitea to filter requests based on request headers/origin? Or a completely different explanation?


#2

Is it a private repository?


#3

Yes. And setting it to public solves the problem. Big thanks !!
Do you know how to retrieve a file from a private repo programmatically? Build the login request? But how to retrieve the password?


#4

I have no experience with it but there does seem to be an API https://docs.gitea.io/en-us/api-usage/