Micropython OTA update from github: ugit

OTA updates by adding uget.py and uget_config.py to your repository!

Currently uget is not able to traverse folders that don\’t have items directly inside of the directory. But more features will be added as we modify it for #openmuscle. We are happy to be able to add to the community.

Ever want to have your ESP32 running micropython to be able to update from github directly? Well now you can without updating the firmware. This simple module will pull the files of your repository and put them into the ESP32 or any other micropython internet connected microcontroller.

ugit: https://github.com/turfptax/ugit

One of the more interesting problems was interacting with the github API through urequests. It seems you need to add the header onfo \’User-Agent\’ or github will deny the connection.

r = urequests.get(tree,headers={\'User-Agent\': \'ugit-turfptax\'})

Also if you try to access the file tree like you find online:
call_trees_url = f\’https://api.github.com/repos/{user}/{repository}/git/trees/master? Recursive=1\’

It will say that there is no tree if you are trying to grab a python repository.

The link needs to be changed to

call_trees_url = f\'https://api.github.com/repos/{user}/{repository}/git/trees/main?recursive=1\'
\"\"
using the \’/master? Recursive=1\’ says not found when on a python repository
\"\"
After changing to \’main\’ it shows up and returns the tree

Notice the change in the last section from master to main. Not sure why this is but eh, we just needed to be able to have OTA updates for openmuscle.

1 thought on “Micropython OTA update from github: ugit”

Leave a Comment

Your email address will not be published. Required fields are marked *