azure functions onedrivesdk python - python

I need to constantly poll a onedrive and when a file is dropped, I need to perform some operations on it and then re-upload it to a different folder on the same onedrive. I thought of using azure functions to download the file to a blob and then re-upload it from there. However the onedrivesdk (https://github.com/OneDrive/onedrive-sdk-python) for python is not maintained anymore. Someone suggested to install the onedrivesdk_fork in github issues. However, that also doesn't work. How should I move forward? any alternates?

Related

How to download numpy array files from an online drive

I have a dataset contains hundreds of numpy arrays looks like this,
I am trying to save them to an online drive so that I can run the code with this dataset remotely from a sever. I cannot access the drive of the server but can only run code script and access the terminal. So I have tried with google drive and Onedrive, and looked up how to generate a direct download link from those drives but it did not work.
In short, I need to be able to get those files from my python scripts. Could anyone give some hints?
You can get the download URLs very easily from Drive. I assume that you already uploaded the files into a Drive folder. Then you can easily set up a scenario to download the files on Python. First you would need an environment on Python to connect to Drive. If you don't currently have one, you can follow this guide. That guide will install the required libraries, credentials and run a sample script. Once you can run the sample script you can make minor modifications to reach your goal.
To download the files you are going to need their ids. I am assuming that you already know them, but if you don't you could retrieve them by doing a Files.list on the folder where you keep the files. To do so you can use '{ FOLDER ID }' in parents as the q parameter.
To download the files you only have to run a Files.get request by providing the file id. You will find the download URL on the webContentLink property. Feel free to leave a comment if you need further clarifications.

How can I copy a file from colab to github repo directly? (It is possible to save the notebook in the Github repo)

How can I save a file generated by colab notebook directly to github repo?
It can be assumed that the notebook was opened from the github repo and can be (the same notebook) saved to the same github repo.
Google Colaboratory's integrating with github tends to be lacking, however you can run bash commands from inside the notebook. These allow you to access and modify any data generated.
You'll need to generate a token on github to allow access to the repository you want to save data to. See here for how to create a personal access token.
Once you have that token, you run git commands from inside the notebook to clone the repository, add whatever files you need to, and then upload them. This post here provides an overview of how to do it in depth.
That being said, this approach is kind of cumbersome, and it might be preferable to configure colab to work over an SSH connection. Once you do that, you can mount a folder on the colab instance to a folder on your local machine using sshfs. This will allow you to access the colab as though it were any other folder on your machine, including opening it in your IDE, viewing files in a file browser, and cloning or updating git repositories. This goes more in depth on that.
These are the best options I was able to identify, and I hope one of them can be made to work for you.

Transform a python file, that uses packages like pandas, to be usable by someone that has no python environment

I have a client for whom I have created a program that utilizes a variety of data and machine learning packages. The client would like for the program to be easily run without installing any type of python environment. Is this possible?
I am assuming the best bet would be to transform the .py file into a .exe file but am unsure of how to do this if I have packages that need to be installed before the program can be run.
Are there websites that exist that allow you to easily host complex .py files on them to be run by anyone that accesses the URL?
I think you are looking for "freezing", which package everything including the interpreter, libs and packages into a single executable file.
There are several tools for this purpose:
https://wiki.python.org/moin/Freeze
https://docs.python-guide.org/shipping/freezing/
I think the use of colaboratory that is cloud service provided by Google might be better. Your client who has to sign up for Google account can not only run the python program, but also utilize any major python packages on the cloud (of course, it's possible to install the necessary packages into the client's cloud space), without constructing the python environment on client's local PC. What's more, it's at free!

How to run Github code (with python) automatically on MyBinder or Google Colab without downloading the Sample code?

MyBinder and Colaboratory are feasible to allow people to run our examples from the website directly in their browser, without any download required.
When I work on the Binder, our data to be loaded takes a huge time. So, I need to run python code on the website directly.
I'm not sure whether I totally get the question. If you want to avoid having to download the data from another source, you can add the data into you git repo which you use to start Binder. It should look something like this: https://github.com/lschmiddey/book_recommender_voila
However, if your dataset is too big to be uploaded to your git repo, you have to get the data onto the provided Binder server somehow. So you usually have to download the data onto your Binder Server so that other users can work on your notebook.

How to download VHD Disk of a VM from azure using python?

I have tried searching for a way to download VHD disk of a VM from Azure, but couldn't find any.
The only way I found to download is by downloading it manually using the steps provided in the link :
https://learn.microsoft.com/en-us/azure/virtual-machines/linux/download-vhd
If anyone has a way to download it using python, please share...
Thanx in Advance...
Essentially, the link you referenced tells you what you need to do to download a .VHD
However, if you want to use Python, there is a library you can use to make common tasks easier.
See this file especially for some more information on how to read blobs in an Azure Storage Account.

Categories