Dial into FTP server (Data logger) using python (OS independent) - python

I have a few data loggers in the field. The manufacturer set them up as dial up ftp servers. I'm writing a python program that automagically downloads all the latest files from the server into a specified folder on my computer.
Which OS independent library do you recommend for dial up?
Do you have any suggestions, comments, or concerns that you can share?
Thanks

Why not use Python's built-in ftplib? Looks pretty straightforward, unless I'm missing something?
For using a modem with Python, this thread talks about using the pyserial module.
I've never used pyserial with a modem, but I have with a USB port and an arduino. It was pretty straight forward, so I'm sure with some research about modem communication you could do it pretty easily. PySerial doesn't come with python by default, but from their site,
[PySerial] provides backends for Python running on Windows, Linux, BSD (possibly any POSIX compliant system), Jython and IronPython (.NET and Mono).
and earlier versions exist for MacOS and others.

Related

Fast Bluetooth LE discovery on Linux?

I’m looking to perform Bluetooth LE device discovery on Ubuntu 22.04, coding in Python 3.10.
I’ve got a prototype using the “pybluez” library, and it’s slow. Very slow compared to other solutions on the same machine.
When I run the “Bluetooth Settings” GUI. It’s at least 10x faster than my python prototype.
When I run “bluetoothctl” and “scan le” it’s also much faster than my prototype.
An interesting third case: I run bluetoothctl, and then open the Bluetooth Settings GUI. I can see the GUI’s scan results in the CLI. Very fast! I’m guessing they both use DBus messages, and the CLI decodes messages also received by the GUI.
Another guess - the GUI issues commands on DBus. The bluetoothctl CUI doesn’t report these, though.
I’m guessing that I could use the DBus Python library to do device discovery as the settings GUI does, if I could see what command messages it writes.
How can I log/inspect DBus messages being written by the “Bluetooth Settings” app? Is there an introspection tool for DBus?
I’ve read the bluez DBus API. It’s a bit thin. Are there other examples of apps using bluez via DBus to discover LE devices?

Which Toolkit to develop Mac OSX/Windows Daemon service

I need to develop a daemon service which also has presence in System Tray. The system tray icon allows users to customize/access some options through right click menu. It might open a window as well manage those options in a better way.
The app would mostly be communicating with a RESTful service, posting and downloading files.
Now I know that for any daemon service, it needs to be native. However we don't have the luxury to maintain 3 different dev pipelines, specially since the app is experimental(but might land up in hands of users)
I have experience in Java/Scala, followed by C++/Python/JS. I would prefer java/Scala (existing codebase) but open to frameworks in other languages.
I was thinking of doing a scala based app with swing for windowing, but it is not pretty.
Any ideas?
We have an App, same base code, running on Windows, OSX and Linux (with system tray) using these two set of components:
The Tanuki Java Service Wrapper to handle the lifecycle of the app. It also allows installing the component as a "native" windows service. Version 3.2.3 is under LGPL if that helps.
The Java 6 java.awt.SystemTray which is supported on most platforms. On OSX, we use a modified version of macify to implement OSX specific gimmicks like doc icons
You could go with JavaFX and the ScalaFX bindings. They look to be very actively maintained, and the syntax seems pretty clean. Only trouble is that it seems to have poor support for using the system tray - see this discussion for details and some workarounds.
You can use Real Studio to create a Windows Service and OS X/Linux daemons. Real Studio creates native apps for Windows, OS X and Linux.

Python Windows Service to Daemon Service

I have written multiple python windows services, and now I need to port them to Linux.
These services are constantly repeating until an endflag is raised signalling the stoppage of work. This is just like any service in windows, it implements the start/stop/restart methods using the pywin32 libraries to hook into the windows' framework. Is there a framework for these command in Linux? I cannot find any documentation on this.
is there a pattern to follow when developing Linux services (daemons)? If so, where can I find these resources?
I know there are many 3rd party packages for Linux Daemon on pypi, does anyone have preferences?
Is there a way to see if a service is running on a different Linux box? Can you start and stop a service on a linux box remotely?
If you cannot check if a service is running in linux, what I was thinking of doing was creating a server that accepts a variety of commands like:
STATUS - informs if a job is running on machine X
TURNOFF - ends the service (if it can be done)
TURNON - turns the service on a machine (if it can be done)
Sorry for the broad range of questions, but I'm a Linux noob.
Thanks
You have a number of different options, but in general you're going to need to look into the Linux side of things, outside of Python, to decide what makes sense. What Linux distribution you choose also makes a difference as some of them use different service management frameworks by default. I personally tend to like upstart, it has simple straight forward config files, and is also there by default in Ubuntu. Take a look at this blog(not mine) it gives a great overview of some of the different options.
Welcome to wild world of Linux, it may seem weird at first, but it's really fun!

Python Script to manage dns in Active Directory

What I want to do is write an Application in Python and deploy it in django(I want to implement it on Linux platform), and that Application could manage DNS remotely in Active Directory(Windows environment).
It's preferred that all the scripts written in Cpython.
I tryed several ways below but failed:
Use a module called dnspython, but it seem only work with BIND DNS, that still doesn't support Window DNS.
Use pywin32 module to invoke WMI, but pywin32 is a module only for Windows platform and failed to work in Linux.
Use Ironpython, it is the only workaround I get, but not so good because all other applications will be in Cpython.
Can somebody provide a resolution? Or a workaround.
In my understand, I need a cpython scripts run in Linux that could remotely manage DNS in Active Directory on Windows platform.
If there is any problem about it, please let me know.
Any suggestions are appreciated.
Set up the windows machine as a chaching nameserver, with the linux box as its authoritative nameserver. That way you can just change the settings of BIND on the linux box, and the windows box should follow along.
This question probably belongs on server fault, though.

Is there any "remote console" for twisted server?

I am developing a twisted server. I need to control the memory usage. It is not a good idea to modify code, insert some memory logging command and restart the server. I think it is better to use a "remote console", so that I can type heapy command and see the response from the server directly. All I need is a remote console, I can build one by myself, but I don't like to rebuild a wheel. My question is: is there already any remote console for twisted?
Thanks.
twisted.manhole.telnet uses the deprecated module twisted.protocols.telnet. It is recommended to use twisted.conch.manhole instead.
Here are some tutorials of how to use it:
Writing a client with Twisted.Conch -- twisted.conch documentation
Network programming with the Twisted framework, Part 4 -- IBM developerWorks
Twisted Network Programming Essentials - Chapter 10 -- Online book preview
Take a look at twisted.manhole

Categories