2

I'm currently looking to make an updater program for my plugins for guildwars 2, but I got a little issue for the last download. The name of the file to download isn't consistent from version to version as you can see there. Asking the creator to update it so it is consistent is already something that has been done some month ago, but as the updates are fairly rare and nothing has been done. Would there be a way to get either all the release files, or to downlaod the using filter so it doesn't get the other ones? For now i've been using the following code to download the other plugins and write them to the corresponding file, but this method doesn't work at all with that specific one because the name of this release changes.

(using python 3.9.6)

import requests

test = requests.get('https://github.com/knoxfighter/arcdps-killproof.me-plugin/releases/latest/download/d3d9_arcdps_killproof_me.dll', allow_redirects=True)
print("code :" + str(test.status_code))
open('d3d9_arcdps_killproof_me.dll', 'wb').write(test.content)

Any ideas on how I could work arround this and still download this last plugin?

André
  • 1,034
  • 9
  • 19
firestorck
  • 31
  • 4
  • 2
    I think your best bet would be to use actual git features. If you want all files, why doesn't `git pull` do the job? If you only want a single file or a directory, you could try to [pull the specific file/folder](https://stackoverflow.com/questions/28375418/git-how-to-pull-a-single-file-from-a-server-repository-in-git). Would that be an option? – André Jul 23 '21 at 12:46
  • I found this kind of answer already, but since I've already done most of the program using python, it would be easier to use a solution that work with it, and I have no idea how to implement this kind of things into my current code, would you have some example on how to make it work on python please? Thanks for pointing it out ! – firestorck Jul 23 '21 at 13:55

1 Answers1

1

If you're looking for an example of how to call git pull from within python, this seems to be a good solution:

The code is using this library: https://github.com/gitpython-developers/GitPython

import git 

g = git.cmd.Git(git_dir)
g.pull()
  • I can't manage to make it work, i think i'm doing something wrong, can you explain it some more please? Also this doesn't seem compatible with compiled distribution programs, so this doesn't seem like the best idea sadly. Very interesting though, I'll give it some more testing, thanks! – firestorck Jul 26 '21 at 19:08