RemotePyLib

A Python Library for importing and executing other python scripts and modules over the web.

A simple Python Library to import and/or execute other python scripts or modules over the web. This API uses python requests library to communicate with the server and obtain the script/module. If the user wants to run the file as a script then the API does so and if the user wants to import the content as a module, the API returns the imported object which can be used as a standard python module.

Why to use?

This library can be helpful for you if your product's file size is growing and you want to reduce it. Also note that this library should only be used in applications where you are sure that network connectivity is present because this library communicates with the server using the internet.

How to use?

Downloading the Library
  • Using PIP (recommended)
    Open up a Command Prompt / Terminal and type:
       pip install --upgrade RemotePyLib
  • From GitHub
    If you have git installed on your system then open up a terminal and type the following command:
    git clone https://github.com/Nalin-Angrish/RemotePyLib.git && cd RemotePyLib

    If git is not installed, then simply go to the GitHub link attached with this article, Click on Code, and then click Download ZIP After downloading, unzip it and open a Command Prompt / Terminal in the unzipped directory.

    Finally, after you have obtained the code and have a terminal open in it's directory, type: python setup.py install
Uploading a test script/module
  • Upload Using Web Portal
    Reach the "Upload" section and upload the file. (The extension of the file must be ".py" only)
    Enter the name which you want to give to that module. (This will be used while importing)
    Enter an Email Address to receive the access token on. (If found out faulty, then the uploaded module will be removed)
    Click on submit button.
  • Upload Programmatically
    Use the following code to upload any python file (replace where necessary):

Executing a remote Script
Use the following code to execute a remote script. (Note: the script will be executed on the local machine):

Importing a remote Module
Use the following code to import a remote Module. (Note: there should not be any python file with the same name as 'modulename' otherwise all the data in that file will be cleared.):




I would also recommend you to read the documentation provided on the project's GitHub page for more information.


Upload a Module

Drag the file here