I am attempting to write a script in python and was wondering if there is a method to delay a line typed into the textbox/inputbox to enable some processing before it is sent to the server.
I would like to utilize python as I have already solved the issue of processing, just not the issue with the interception.
Thanks in advance.
I'm not pretty sure, but after seeing the xchat API for python I saw some functions that maybe could help you. Anyway, the best you can do is check out the documentacion for yourself here http://xchat.org/docs/xchatpython.html#head-baa362bb6aeeed1851452bd2ecc9253317db1e64.
Good luck!
Related
I just recently learned Python and now I thought about making a very simple online game for fun. I don't know what the game should be but I thought I should be able to somehow communicate with others playing the game.
I figured I could save actions I'm doing in the game in a file on a Webserver. The game should then run some function for the other players if the file gets changed. Now my question: Is there any way to watch that file for changes? I tried watchdog but as far as I found it only works on local files. I could probably use a loop with urllib2 checking the content but I'm afraid that's not very elegant or fast.
Im using Python 2.7.13 on a Windows 10 computer.
Thanks in advance for your answer :)
(disclaimer, I agree with #roganjosh in the comments, I don't think this is the right way to approach your problem, but just to answer your question)
In order to monitor changes in a webserver, unless they provide some other API, usually you do implement a loop but instead of getting the whole file all the time, you only send a "HEAD" request. If you see updates in the file then you fetch it.
See this answer for more information: How do you send a HEAD HTTP request in Python 2?
I am absolutely new to Python and the Rasberry Pi. I had a look at the Yowsup library to be able to send a Whatsapp message with my Rasberry Pi.
By using yowsup-cli I can send a message etc.
My problem.... I dont understand the sample programs at all. From a .NET background I would think that one would create an Object and then perhaps do something like Object.SendMessage("Number", "Message")
The examples seems to be much more complicated. I truly dont understand. Have someone written a simple Python Script before doing what I want to do? Just as an example so that I understand more clearly? I have done a lot of reading. I guess I am stuck with .NET in my head.
Thank you!
Jaco
I'm looking for a Python module/framework/package that will assist me in making a sort of "better" console for my application. As it stands now, STDIN can be "pushed" to new lines by other messages being logged out to the console, therefore making it difficult to read what you are trying to type into a server console if it is a long command, or you are prone to typing errors.
Are there any sort of already existing modules that can help me do this? If it helps, it can be comparable to JLine, (at least I think, I have no first-hand experience with JLine).
Oh, and if you don't understand what I'm talking about, you can check the closest thing I can find of an example here. Basically, that bottom line in the console is where all commands are entered, and it doesnt get pushed back when the server is in use; it is sort of static in a sense.
Any ideas? Thanks!
readline module helps to build a nice prompt with history and auto-completion:
http://docs.python.org/library/readline.html
curses module allows you to separate the console into windows that can be separately scrolled:
http://docs.python.org/library/curses.html
Got a simple question regarding twisted.
I can create a trivial basic test with a web server like apache, where http://foo.com/index.php instantiates the index.php for the "foo" site/app...
I'm trying to figure out how the heck I can create a twisted server, where I run different backend functions based on the input!
I know, embarrasingly simple.. but none of what I've seen regarding twisted/server/client/etc.. discusses this.
Comments/pointers/samples are greatly welcome.
thanks
Have you read this?
http://krondo.com/blog/?page_id=1327
You may find http://twistedmatrix.com/documents/current/web/howto/web-in-60/index.html helpful.
Is it possible to make python run on your homepage? I know, this is a really stupid question but please don't pick on me for my stupidity :)
If it is possible, how? Do you have to upload/install the executing part of Python to you website using FTP? or...?
Edit: Just found out my provider does not support python and that shell access is completely restricted. Problem solved :)
Everything depends on the hosting provider you use for your homepage -- do they offer Python among their services, and, if so, what version, and how do you write server-side scripts to use it (is it CGI-only, or...?) -- if not, or the version / deployment options disappoint, what do they allow in terms of giving you shell access and running long-time processes?
It's impossible for us to judge any of these aspects, because every single one of them depends on your hosting provider, and absolutely none of them depends on Python itself!-)
Yes, you can. I don't know exactly how but I know it is possible. Mabye look into this website:
https://trinket.io/
This website lets you do this. I sent them a message to see how they do it so I will update this to let you know after they respond.
Python is a scripting language, though it is used gracefully for building back end web applications.