Can Twisted Run SFTP FTPS and HTTPS Server At Once [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I may be too ambitious and what I am trying to accomplish May not even be possible using twisted, but I would like to develop an application using Twisted that does all of the following.
Run an SFTP server
Run an FTPS server
Run an HTTPS server (web UI for transferring files)
All of these protocols will share a single database for user authentication.
I would also like to create a scheduler that can trigger files transfers on some time interval.
This framework seems limitless when reading through the docs on the site, but it's hard for me to dive in and figure out if Twisted is capable of doing all of the above without knowing it inside and out.
I am still going through the examples on their site and it seems like there is a steep learning curve to really grasping how to do these things.
I would appreciate any feedback or pointers on how to accomplish this, if it's possible.

Yes, it absolutely can.
From a Twisted perspective, there is a support for pretty much everything you ask for - SFTP, FTPS, HTTPS and scheduling.
When it comes to database integration, I would use standard Python db libraries. I don't think you need anything special from Twisted for that.
Scheduled tasks could be accomplished through either Python scheduler libraries or using Twisted's reactor framework.
Regarding the SFTP, FTPS and HTTPS:
SFTP server can be implemented using Twisted Conch. Documentation is little bit skimpy, but yes you can do it.
Take a look at this source code and look for the implementation of class SFTPServerForUnixConchUser.
FTPS is, to the best of my knowledge, a matter of using a third party package.
HTTPS is a mainstream.
Here is an officially documented setup.
(I suspect that my answer will become obsolete in a year when all these features get incorporated into a main release.)

Related

Django deployment best practices [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Safaribooksonline.com has a video [1] from Jacob Kaplan-Moss about how to deploy a Django app. This video is from 2010. It refers to a site [2] that has a list of many relevant aspects.
Now the workshop mentions things like virtual machines, vagrant (as deployment environments) or Fabric and other tools for deployment automation.
I was wondering how much has changed since then. I can think of Docker replacing Vagrant. Or Heroku or AWS instead of renting a dedicated physical server for deployment (or virtual machines). Or using Ansible or Chef / Puppet instead of Capistrano or Fabric.
But what else has changed? What is still relevant? What is done differently? What is the state of the art in 2017 for deploying a production ready Django app.
Can anybody point me to good blogs / books / tutorials?
[1] "Django deployment workshop", https://www.safaribooksonline.com/library/view/django-deployment-workshop/9781449396442/
[2] "infrastructure of modern websites", https://randomfoo.net/2009/01/28/infrastructure-for-modern-web-sites
Honestly, the answer to this question will be extremely opinionated and defining best practices in ever-changing devops area can be challenging. Something is a best practice one day, and tomorrow someone makes a blog post about that being god awful and obsolete.
There are numerous ways to do deployment, but it all comes down to what do you need, how much do you want to automate and what level of customization is required.
For instance, at my current place we use CircleCI, Heroku, Sentry and
Rollbar.
One of my previous clients (three months ago) wanted us to use
CodePipeline which includes CodeCommit, CodeBuild, CodeDeploy for
AWS.
Recently I also worked on a project involving Docker and flexible
environment from Google App Engine.
For my personal projects I simply use Fabric and Heroku, but I'd really like to try the new CodeStar or whatever the name is on AWS.
Define what you want, how you want to customize it and simply do it. If something does not work out, just change it. Things are becoming easier to do and replacing one item in your pipeline can occur in matter of minutes and not days/weeks as it did. Nowadays every provider has support for Docker and CI, one way or the other.
YMMV.

Is it possible to install Python on a server so that any connected computer can use it? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
So my office has a company server to which all computers are connected. I've written a Python script which I would like to make available to all people in the office. Is there a way to install Python directly on this server such that this is possible?
Now, I know what you're thinking: make it an executable. I've tried that using py2exe and its just been a miserable failure. The executable it makes is slow, glitchy, and I have to jump through a ton of hoops just to get it to the barely functional state I've managed. The biggest issue is the use of modules which my program edits. To get these to update I have modify a zip archive which does not happen reliably. Installing Python to the server is the best workaround I can come up with for py2exe. I am asking if it is possible and, if yes, how to do it. If it's not, I'd love to hear whatever workaround y'all can come up with.
EDIT: Things I forgot so say, the server is Windows 64-bit, and I would prefer to not modify it directly (ie, I would like to do everything from my computer if possible)
Things I tried:
Installing vanilla Python directly onto the server. This didn't work since the actual dlls were not accesible to other machines on the LAN
Setting up path variables through the network to a machine which has Python installed. This didn't work because of firewalls on the network and such.
Since your trying to run py2exe, I'll assume windows clients for the following.
If they don't have python on their local system you can make a server share and serve out python from that location.
You can run this line in a .bat file
\\server\share\distribution\python.exe \\server\share\scripts\my_script.py
On a UNIX system:
ssh user#server-ip-address python path/to/myscript.py
If you run a *nix environment then the best way would be to use SSH. If you don't use unix then you can still run an SSH server and clients on Windows, it is just slightly more painful.
Virtual machines can also be an option.
Depending on the application, it may work as a web application. In which case look into create a web application with Python (there are many tutorials out there).
Edit: So for an SSH server, it basically gives you command line access to a remote machine. If you are on windows you need to install an SSH server. If you are on *nix then you probably have one installed. On the client if it's Windows, you install an app like Putty which allows you to initiate the connection. On a *nix machine you run something like:
ssh username#serveraddress
And you will get a connection. Then you just browse and run the programs as you normally would at a command line.

Is there a updated Python module which I can use to communicate with a Minecraft server? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I looked up myne and mc3p, but those didn't even work with my old copy of Minecraft 1.8. If there is some module that allows me to communicate with a minecraft server as if my program was the Minecraft client. If it is available, I could settle for a module that allows you to simulate a Minecraft server and have minecraft client connect to it. I tried to implement my own using the socket module and the struct module, but I am bad at both. I have Python 2.5 with Windows XP. Thanks!
This site has a list of client implementations. From that, I saw the following clients that were implemented in Python:
Twisted Bot
pyCraft
esbot
mcclient
Keep in mind that the Minecraft server is not designed for 3rd party clients to connect to it: the client/server protocols are not an open spec that Mojang freely supports others to use. It just so happens that the Mojang doesn't typically come down hard on 3rd party mods (in fact, they hired some 3rd party modders). Mojang is still in development of their official modding APIs, and so any library created now that interfaces with Minecraft can only be supported as well as the library author can reverse-engineer the Minecraft system, and keep up to date with changes in Minecraft.
Because of this, expect the libraries you find to be error-prone or have difficulties working on different versions of Minecraft.

Recommendations for Python cross-platform listener server [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I need to create a simple server/daemon which just waits for commands, (maybe queues them up), and executes other commands based on the received input. Here are more detailed requirements:
Should be in Python since I need to use some other Python code I wrote for it.
Needs to work on at least Linux and Windows (Will be running as an init.d service on Linux and
as a Windows Service on Windows)
Communication medium should be as simple as possible and hopefully commands can be sent to the server from a batch script
Commands come from the same machine. Performance isn't important.
Installation on Windows (including all the libraries needed to send a command to the server from a script) should be simple. If everything can be wrapped into a single .exe all the better.
What's the best stack to use for this? I have only a few vague ideas:
CherryPy (Windows doesn't have cURL though, ugh...)
dbus and windbus (never used these before...)
In my experience (and I've implemented three or four applications similar to what you've described), all things created equal, and I've found it simplest to go with a subclass of SocketServer.TCPServer and implement my own, simple, command system. This gives you full control over the details (need streaming? No problem; need stateful connections? No problem), and isn't all that tricky given some basic knowledge of how sockets work.
On Windows, I understand that py2exe does a good job.
A couple alternatives/tools you might want to consider:
SimpleXMLRPCServer and xmlrpclib — if you can live with the constraints imposed by HTTP + XMLRPC (stateless, streaming is tricky) this will get you up and running in about 5 minutes. Also note that the SimpleXMLRPCServer is single-threaded. It's possible to make it multi-threaded (or multi-process, or whatever), but that will take a little bit of work.
On Linux, python-daemon is a possibility for daemonizing, but I've usually found start-stop-daemon to be simpler (if it's available on your platform)
Is it possible to run a Python script as a service in Windows? If possible, how? should help you running the script as a service.

Good Python library for AMQP [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
Can you recommend what Python library to use for accessing AMQP (RabbitMQ)? From my research pika seems to be the preferred one.
My own research led me to believe that the right library to use would be Kombu, as this is also what Celery (mentioned by #SteveMc) has transitioned to. I am also using RabbitMQ and have used Kombu with the default amqplib backend successfully.
Kombu also supports other transports behind the same API. Useful if you need to replace AMQP or add something like redis to the mix. Haven't tried that though.
Sidenote: Kombu does currently not support the latest pika release (should you rely on it for some reason). Only 5.2.0 is currently supported, this bit me a while back.
Pika is the RabbitMQ recommended library, and py-ampqlib is also mentioned. Depending on what you're using Rabbit for, you might also want to look at Celery (a client library dedicated to distributed queuing).
Again, depending on usage, you might also want to look at Apache's qpid which is a full AMPQ-based client-server alternative to RabbitMQ. One thing that attracted us to qpid was that it seemed to have better robustness on server crashes (queues are persisted in a distributed fashion).
Having looked at all these libraries, I am now convinced that the right answer is none of them. Instead, build an abstraction layer as a shim over whatever library you choose because you are bound to run into a situation where you have to change libraries.
But do remember, that if you stick to the same version of the AMQP protocol, these libraries do interoperate. Due to different libraries being tested, we had parts of a prototype application running pika, kombu and py-amqplib.
Read this blog about replacing amqplib with pika for a sense of why this is a good idea.
I am currently in the middle of making our Python app use SSL. I did not originally develop this application (nor am I a Python developer), so I don't know much about it, but we seem to use the AMQP Client in Twisted.
QPid also has one. Again, I don't know the quality.

Categories

Resources