I am trying to use mqtt protocol in this websocket api address wss://meri.digitraffic.fi:61619/mqtt .
It has username and password userName:digitraffic
password:digitrafficPassword.
plus (ssl needs to be enable) and i need to subscribe the message vessels/# from that websocket api address .
I have found some links MQTT over websocket in python.
I have also followed documentation of this one https://pypi.org/project/paho-mqtt/ and it works if i put the exact address given in the documentation but fails when I put my above address with username and password.
How can i use my websocket address in that paho-mqtt. Can this achieve using simple websocket library ? I am new in this stuff and any kind of help would be helpful.
Related
I am in the process of building a custom authentication for email accounts. The imap/pop3 server is dovecot. The dovecout have an easy option to use Key-value authentication (dict) database via socket. The have the documentation and perl socket server example in https://doc.dovecot.org/configuration_manual/authentication/dict/
I need a socket server in python to enable authentication via socket url
uri = proxy:/var/run/auth_proxy_dovecot/socket:somewhere
What inputs are need to send the socket?
What is the format of the input ?
What are the output format expected ?
I was unable to find any such developer documentations regarding it .
The only documentation they say is it use the protocol https://github.com/dovecot/core/blob/master/src/lib-dict/dict-client.h
I understand it is a simple script , but if some one wrote such python script or socket program , it will be good to know where to find those documentations.
I wrote a python server using the socketserver class To read data from the socket and process it.
I want to use pymodbus server as a convertor between an api and modbus. I have succesfully set a modbus server and im updating holding register values from an api device. Now i need to write values to this api but i need to detect when a modbus client writes values to my modbus server. It will be enough if someone show me how to print written address of register and value to a console. Im using this code for creating the server: https://pymodbus.readthedocs.io/en/latest/source/example/updating_server.html
Thank you.
Is there any way to implement http connector for sending messages(MT) in Jasmin? According to documentation jasmin HTTP API supports smpp connector only.
Update 1:
More information of scenario:
I have 4 sms providers that I need to implement using Jasmin.
one of them is using SMPP protocol and is working fine with jasmin using smpp connector.
Other 3 have http protocol (call url with params to send SMS).
I want to use http protocol with jasmin to use its routing and other stuff.
Jasmin only supports HTTP client connectors for MO (mobile originated) messages.
Having found myself with the same scenario as yourself, I found the simplest solution was to write an SMPP-to-HTTP service which allows Jasmin to connect to it and relay MT messages via HTTP. Hope that helps
Here is the overview for adding Http MT support in Jasmin:
Add connector class and manager for http MT connector
Add router manager
Modify smpp protocol module and detach http mt call from this module before it is dispatched to smpp queue. Detachment will be done after router has selected your custom connector and user balance etc is deducted from user account but before transaction is queued.
By detachment means use your own queue (rabbitmq queue) and and publish your transaction on this.
Create subscriber for rabbitmq and response back as required.
Using this method will return same message id and responses like smpp.
For more details or help please comment.
I'm going to transfer crash dumps from clients to me through the mail mechanism. Therefore, I can't use any public SMTP servers, as packing any account's credentials with the application is unacceptable.
Therefore, I need to send mails through my application directly to the destination mail server.
How can I achieve this in python? (I'm using windows so sendmail is not an option)
Just use smtplib in the standard library.
Trying to write code that can send mail to anyone is problematic, because smtplib connects to servers client-to-server style rather than server-to-server-relay style.
But if you only need to send mail to one particular server, which you control, it's trivial. Just configure your server at 'mail.example.com' to accept any mail from 'crash-reports#example.com' to 'crash-reports#example.com'.
Your code will look something like this:
import smtplib
addr = 'crash-reports#example.com'
def send_crash_report(crash_report):
msg = ('From: {}\r\nTo: {}\r\n\r\n{}'.format(
addr, addr, crash_report)
server = smtplib.SMTP('mail.example.com')
server.sendmail(addr, [addr], msg)
server.quit()
As a side note, if you're just starting on a crash report collector, you may want to consider using a web service instead of a mail address. You're going to run into problems with people who can't access port 25 through their corporate firewall/proxy, write code that extracts the crash reports from an inbox (and/or searches via IMAP or mbox or whatever), deal with spammers who somehow find crash-reports#example.com and flood it with 900 messages about Cialis for each actual crash report, etc.
i'm trying to connect my local XMPP server by the code coming below
import xmpp
client = xmpp.Client('localhost',debug=[])
client.connect(server=('localhost',5222))
but i always get this message :
An error occurred while looking up _xmpp-client._tcp.localhost
i've checked that the port 5222 is already opened(by using telnet).
(i have to mention that the firewall on the localhost is off)
now what should i add to this code to make it work ?
This message (a warning, not an error as pointed out in xinox's answer) is indicating that a DNS SRV record lookup failed. DNS SRV records are used to find services that are associated with a certain domain (eg. localhost in this case, so not really a domain at all which is why the lookup is failing), but which delegate their responsibility to a server living somewhere else.
For instance, if I have a server at example.net, making my Jabber ID (JID): user#example.net, but my XMPP server lived at chat.example.net I could construct an SRV record on example.net to point to chat.example.net. There are other ways to delegate responsibility, but this is the preferred one. XMPPs use of SRV records is defined in RFC 6120 ยง3.2.1.
To actually get rid of this error you can use the use_srv kwarg, making your initial example:
import xmpp
client = xmpp.Client('localhost',debug=[])
client.connect(server=('localhost',5222), use_srv=False)
use this.
client = xmpp.Client('127.0.0.1',debug=[])
client.connect(server=('127.0.0.1',5222))
or your IP 192.X.X.X