Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I am making a project that is suposed to be some sort of smarthome solution. My code is written in python and I wish to controll the inputs of for example a timer to switch of the lights and set a wakeup alarm through a website on my lokal network. I plan on using a raspberry pi (3B+) for the hosting.
Is there a way that lets me give inputs and se the outputs on the webpage?
You could use a html form and have the user (you) submit it when you make changes, this is the method I would recommend.
You could also use JavaScript on the webpage to automatically send a request to the server on value changes (in an HTML form) for it to configure the server.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 days ago.
Improve this question
I use this library: https://github.com/yusufusta/ytstudio
When you are uploading video, to interact with youtube api you need to have SESSION_TOKEN
I checked documentation and i have seen that i need to make request to studio.youtube.com and get response of /grst endpoint.
Can i get SESSION_TOKEN without entering to youtube studio in python automatically?
I tried to send request to /grst but i couldn't do it.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 days ago.
Improve this question
Good morning all, I am struggling with TD ameritrade’s authentication process, specifically the 30 min life span of the bearer key.
I have written a Python script to run the authentication process (https://developer.tdameritrade.com/content/simple-auth-local-apps). It’s partially automated, except for the pause to deal with the two step verification (which I can’t work around).
The trouble I have is that if the bearer key needs to be updated every 30 minutes, and the process script isn’t fully automated, it defeats the purpose of having a bot that can run and execute trades.
I see references to a refresh key, but not sure how to implement.
so far I have tried forums, YouTube , and reaching out to others within my network.
Any help is appreciated
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I am proficient in Bash and a beginner in Python (I have some experience with Flask and Requests).
I wrote a Bash script which asks for some input (four strings) and creates a configuration file based on that input. That's good for me, but I would like to convert it to a (no frills) web interface. I know how to configure Apache, if necessary.
I know there are zillions of ways to do that. I'd like some hints on how to tackle my problem, ideally using Bash or Python. By the way, I've used Octave on CGI for some of this in the past, and I think it's excellent for math purposes, but I'd like to get ideas about some simpler, more generic avenues.
I would create a Django site for this. It can be setup really quickly. I would recommend you host it on PythonAnywhere. They have a free tier, and works really well. Django is similar to Flask, but I personally like Django. If you could be more specific on what your App needs to do, some sample code could be provided.
You probably just need the right keywords to go the right direction. From a high level all you need to to is two steps:
Create a static html web page that contains a form. This form contains at least one input field and a submit button. The URL it accesses needs to be understood by your webserver to invoke your script via the common gateway interface (CGI).
write a python or bash script that Apache can invoke via CGI that receives the value and does something about it. The stdout of this script will be returned back to the browser, so it better be HTML again.
For details check out http://httpd.apache.org/docs/2.4/howto/cgi.html
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
so my python application opens a link that would be found in my config file. I would like to make it so it would like to allow it to go to the website without doubling the %. Heres what I would want config.get('CONFIG', 'Website') the web address has a bunch of %'s in the link but when I run it, the process ends
I'm assuming you are using the configparser module?
If so, you can use ConfigParser(interpolation=None) to disable string interpolation (which controls the behavior of % characters in the config file).
(Or on older versions of Python, you may need to use RawConfigParser instead.)
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Let me preface with saying I am a beginner and have been learning Python on my own because I got bored with bash.
I've been searching google but came up with nothing really. I just want to be able to have a user hit a button and then the script does what it does. So a way to embed my script in a box on a blog or something and you hit a button and bam! you get the output of the script.
Is there something that looks like what this site has: http://www.learnpython.org/
whereas you click a button and the script outputs to a window?
If you are looking to run relatively simple scripts, you can try something like Brython, which will interpret you script using JavaScript in the browser. If you are looking for more complex, server-side scripting, you should try looking into one of the Python web frameworks like Django.
Browsers don't directly understand Python; they only understand JavaScript for dynamic content. So, you will either want to learn JavaScript, or embed a Python interpreter like empythoned.
In the link that you gave, a post request is sent to learnpythonjail.appspot.com and a json response is received which contains the output. Basically you can do the same by sending the input via post to that site and you can display the response by parsing the response json. Hope this helps. :)