Demo a CLI program without a notebook - python

A client has asked that I put together a Python program to demonstrate some core concepts of a possible ML app. We agreed I would make a CLI for now just to show how it would work and later we would make a web interface.
I wrote up a proposal and he read it and agreed. I'm now 100% done with this project and would like to collection the 2nd 1/2 of the payment.
Originally he said a video of the functionality was fine, now he is saying it's not and he wants to 'play with it'.
I don't want to give him the code, and I really don't want to do any more work for this client until he pays the rest of the money.
Here's my question: Is there a way to publish a Python CLI online without:
Doing a lot more work (like making a web interface).
Exposing the source code.
If he had to SSH into somewhere that might work.

Related

How can I upload my python trading bot to the internet for auto-trading?

I have written a python code that I can run it on my computer. It gets stock data from a website by GET request. Then it does some calculations on upon these online data and decides to send a buy/sell request to my broker's account.
All of these works fine on my computer, but I like to upload my code on a web server to preventing electricity/internet disconnection. I think I should upload my code on a virtual server, but this is all the thing I know and I don't have more experience or knowledge about it. I don't know if it is what I need, how can I do that?
In my experience of making some simple web pages, we should put our main code inside the public.html file? So should I buy a web host and wrap my python code inside a .html file?
Sorry if they are simple/stupid questions but I couldn't find any answer or guidence for doung what I want, so I asked here!
With the info you provide I can't really be sure how your script is ran.
I presume you run it by shell in that case a simple vps should suffice.
No need to mess around with a webserver.
Maybe look at Digital Ocean. They are a market leader and the simple $5 option probably enough for your purpose.
When you set it up you can connect to it with ssh (preferably with a ssh key because you are working with financial data) and setup your python script as if it were your own computer.
Ps. I don't work for digital ocean or get money from the link. It is just an example, any vps will work.

Right tools to make a GUI / web interface app

What I want to create is a music player that can interact with YouTube using its Data API.
I actually have already developed my application (only for Windows, multi-platform is not a priority at the moment) using AutoIt and it's working properly. For now I createad a GUI to simply execute mpv.io, send commands to it and get its STDOUT to manage informations/errors.
Now I wanted to create a web interface to control this application using my smartphone in particular. I tried to look into TCP implementation and also WebSockets to send real time information like the playback position, but I'm not too sure what to look into.
As you probably can understand, I don't have much experience especially in network stuff so a help would be much appreciated. In the past I've fiddled with HTML,CSS,JavaScript so the web interface should not be a problem but for the communication part I don't have many ideas.
Since I created some very basic application with Python in the past, someone already suggested me to use a web framework like Flask, and so I started to properly learn Python but I find difficulties with GUIs...
So, to do a little summary I'm currently asking what can be a proper method to develop this application, also starting from scratch and changing programming language, since I'm always open to learn something new.

How do python scripts work?

I just learned how to read and send emails using python and I read that you can create a python script that can read someone's twitter or facebook and send you an email whenever a specific person posts something on twitter or facebook, but how does this work?
What is the difference between a script and just a regular program? I don't think that if someone is doing something like this that they would need to have their computer on at all times and have the python program running in the background, or is that what is happening?
A python script is a kind of program.
To make what you're talking about, you'd need to either have some kind of notification when someone tweets or something to check constantly for new content.
Either way, the computer will have to be on at all times (for that, you could use a Raspberry Pi for example, so you don't take that much power). (EDIT : you can of course also have a server doing that for you, but it's still a computer running at all times.)
You'll need to get your hand onto the Twitter API documentation. There is probably a python wrapper.
(EDIT:Tweepy - Would be the aforementioned python wrapper)

Delivering Python Processed data to the web

I have developed a python program that parses a webpage and creates a new text document with the parsed data. I want to deliver this new information to the web. I have no idea where to start with something like this. Are there any free options where I can have a site automatically call this python code upon request and update the new data to its page? Or is the only feasible solution here to have my own website/server that uses my code? I'm honestly pretty overwhelmed with many of the options when I try to begin doing a web-search for a solution like this. I have done a decent amount of application programming before so i'm confident in my ability to learn new things, but web protocols are all new to me so its hard to find a starting point.
Ultimately I want this python code to run automatically, or per request of a user, and deliver to the data to them. It could even be through an email, although that is probably less practical.
I personally have good experience using Google Appengine (and its free for a limited amount of requests). The downside is that it does not allow C-extensions or Python3.
If you want to host your own server, tornado is a good option I think. Tornado supports both Python2 and Python3.
There are a great deal of options available.. from 'traditional' virtual server or website hosts like a2hosting or godaddy to 'Cloud Application Hosts' such as Amazon EC2, Heroku or OpenShift.
For your case, and without knowing more, I would suggest that an application hosting is more appropriate, and that you should take a look at Heroku and Openshift in particular.
Define carefully what you want to achieve (how the users access your application, what they see, how they interact with it... etc..) and then evaluate these options based on those requirements.
Most offer a free trial, or even free services, depending on what you need! Good luck
If you've never worked with web technologies before this will be a overwhelming task, since there's a lot of different technologies involved, and many possible ways to combine them.
You'll probably want to start by familiarizing yourself with the very basics of the HTTP protocol.
Then you should read a bit on CGI server-side programming (the article also has a quick overview on HTTP).
Python can run both on CGI and WSGI (if the server provider allows such access), so you may also want to read about WSGI.
Once you grasp all these concepts, you should check this question for actual python techniques.
Also, since you seem to be under the impression you must pay to have a website/app deployed, you should know there are companies that host python apps for free

Can I "embed" a Python back-end in an AIR application?

I'm trying to find out if there is a way I could embed a Python back-end into an AIR application? I'm looking to employ an approach similar to the one outlined here to implement the business logic for my application, but additionally, I would like to provide the user with a single binary which they can load. I don't want the user to have to fire up a seperate server process to make this work. Is this possible in some way or am I out of luck?
You cannot embed your Python server in an AIR application. So basically you are out of luck.
The simplest solution probably is to run a server on a central location that all your users can connect to from their AIR apps. That means that all/most of the data will be on your server, and not on the users computer, I don't know if that is a big issue but I guess it is.
Also depending on your target systems you could create the program you want yourself without (fully) depending on AIR. You can generate executables for windows and osx from Flash CS3/4 or you can use a special (commercial) executable-maker that provides some more functionality. Wrapping this exe and your python program in a meta-executable that launches both should be possible with some work. Of course you won't have the benefits if the AIR installer etc in this case.
OK, so since it didn't seem possible to go that way around, I came up with an alternative that seems to work for what I want.
Instead of trying to embed Python inside AIR, I've gone the other way around: I'm building my Python code into a stand-alone executable using PyInstaller and bundling the AIR application as a resource. The Python code then starts up it's webserver and fires off the AIR app which can then connect to the (local) remote services as required.
Probably. We are using a J2EE server side which uses SOAP webservices to talk to our AIR application on the frontend. You should be able to do the same because soap doesn't care which technology sits on either side of it.
You can always have the application launch from a single binary which first fires up the server, then the client, if both are expected to sit on the users system. Also it gives you flexibility to have a more service oriented model later, if you want to. Without knowing what your app does, it is hard to know if that makes sense or not.
For setting up the python side of SOAP webservices, here's a useful link to a diveintopython article. Then, if you have your server running with the wsdl, FlexBuilder can generate the AIR side of the webservices for you.

Categories