sdushantha / gitdir Goto Github PK
View Code? Open in Web Editor NEWDownload a single directory/folder from a GitHub repo
License: MIT License
Download a single directory/folder from a GitHub repo
License: MIT License
Just a reminder the package in the PyPi :)
Hi,
I tried using to download a folder as below and getting 403 Forbidden error. It is a public repository. Please clarify what are the other pre-requisite to run this.
F:\GitRepo\spring-hateaos>gitdir https://github.com/eugenp/tutorials/tree/master/spring-boot-rest
Traceback (most recent call last):
File "f:\python\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "f:\python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "F:\Python\Scripts\gitdir.exe\__main__.py", line 5, in <module>
File "f:\python\lib\site-packages\gitdir\__main__.py", line 3, in <module>
main()
File "f:\python\lib\site-packages\gitdir\gitdir.py", line 150, in main
total_files = download(url, flatten, args.output_dir)
File "f:\python\lib\site-packages\gitdir\gitdir.py", line 64, in download
response = urllib.request.urlretrieve(api_url)
File "f:\python\lib\urllib\request.py", line 248, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "f:\python\lib\urllib\request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "f:\python\lib\urllib\request.py", line 532, in open
response = meth(req, response)
File "f:\python\lib\urllib\request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "f:\python\lib\urllib\request.py", line 570, in error
return self._call_chain(*args)
File "f:\python\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "f:\python\lib\urllib\request.py", line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden
Thanks,
Ranga
Can you add the feature to call the script from the bash without the need to clone the repo.
When trying to download a folder with many files, the github rate limit is reached too fast. Is it possible to download a folder in one request (zip file?) instead of requesting each files/folders in it?
I don't know python well, I just deal with it simply. You compare it.
Is the possibility of using the library via code coming soon?
When gitdir url
, the following error occurs. Any ideas?
ConnectionRefusedError: [Errno 61] Connection refused
...
gitdir/gitdir.py", line 99, in download
urllib.request.urlretrieve(file_url, path)
i.e. https://github.com/sdushantha/gitdir/blob/master/gitdir.py
.
As it stands, gitdir will fail if the branch path does not start in tree
. It looks like this only happens (at least on Github) with the default repo branch.
Given a repository or directory, only download files within that match a regex specification
The link to directory that I want to download: link
env: ubuntu 16.04
When trying to download all files from a nested dir, i want to output just the files to a single directory. However, it seems the flatten option just overrides the output directory and will just go to the current folder no matter what.
Here is the command I used:
python -m gitdir https://github.com/standardnotes/app/tree/main/packages/components/dist/zips -d zips -f
I have access to my students's private repos, and i usually need to download specific folders of their repos. This tool seems great, but it apparently does not work with private repos (i do have access though).
hi
I followed the instructions as i found the concept interesting
when installed, whether with pip or pip3 as a none root account.
By default, 'file' is written in the MIFF image format. To
specify a particular image format, precede the filename with an image
format name and a colon (i.e. ps:image) or specify the image type as
the filename suffix (i.e. image.ps). Specify 'file' as '-' for
standard input or output.
import: delegate library support not built-in '' (X11) @ error/import.c/ImportImageCommand/1297.
/Users/abuxton/src/gitdir/gitdir.py: line 10: ERASE_LINE: command not found
/Users/abuxton/src/gitdir/gitdir.py: line 13: syntax error near unexpected token `('
/Users/abuxton/src/gitdir/gitdir.py: line 13: `def create_url(url):'
is output on running the command, also worth documenting ./gitdir.py
the file will need to be executable.
the reson for the output is running without python3, osx default is not yet 3. pyenv or some such can be used to update system python default.
It would be nice if someone could test this out on WIndows and see if everything works perfectly, so that I can add to the README that gitdir
supports Windows.
Hey,
I want to use this package without a command-line interface. I want to use it in the python program.
Is there a way to do that?
I keep getting this error from any repository url.
The given url is a complete repository. Use 'git clone' to download the repository
Windows support is enabled if #10 gets merged. On my machine color code does not work on Windows terminal. The output I get:
I'm trying to download a folder from github into a local directory. This is the code i'm running on command line:
gitdir --output_dir C:\Users\HP\Documents\datafolder https://github.com/Abba00/ImageDatasets/tree/main/SmallDataset
The command creates the "datafolder" directory but still downloads the github folder in it's own directory which isn't the desired result.
Please could you offer any help on this? It would be highly appreciated.
Thanks for this tool! I accidentally overwrote some of my files earlier, and I think this is a preventable mistake.
You can reproduce the problem with:
$ cd /tmp
$ gitdir https://github.com/sdushantha/gitdir/tree/master/gitdir
Downloaded: __init__.py
Downloaded: __main__.py
Downloaded: gitdir.py
✔ Download complete
$ echo "will be deleted" > gitdir/__main__.py
$ gitdir https://github.com/sdushantha/gitdir/tree/master/gitdir
Downloaded: __init__.py
Downloaded: __main__.py
Downloaded: gitdir.py
✔ Download complete
$ head gitdir/__main__.py
from .gitdir import main
main()
I'd propose adding a prompt to confirm, and a --force,-f
flag
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.