Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

urlparse module not available in python 3.7.3 #3

Open
Jenriksen opened this issue May 6, 2019 · 1 comment
Open

urlparse module not available in python 3.7.3 #3

Jenriksen opened this issue May 6, 2019 · 1 comment

Comments

@Jenriksen
Copy link

It would seem that the urlparse module is no longer available in python and I am unable to find a suitable replacement. What are your suggestions?

@MRTUNC
Copy link

MRTUNC commented Nov 25, 2019

Urlparse Library is not avaliable.I try communicate between publisher and subscriber to connect cloudmqtt.com broker but it isnt work.
would you please tell me something that what is wrong ?

this my code :
publisher::

import paho.mqtt.client as paho

import os
import json
import time
from datetime import datetime

.
broker="farmer.cloudmqtt.com" .
topic="test";
topic2="TUNC"

port=15516

def on_publish(client,userdata,result):
print("published data is : ")
pass

client1= paho.Client()
client1.on_publish = on_publish
client1.username_pw_set(username="datax-pi",password="123")
client1.connect(broker,port,keepalive=60)
i=0

while True:
i=i+1

payload="aa"
client1.publish(topic2,payload,qos=1)
print(payload);
print("Please check data on your Subscriber Code \n")
time.sleep(5)

subscriber::
import paho.mqtt.client as paho
import time
import sys
import datetime
import time
import sqlite3
broker="farmer.cloudmqtt.com"
topic="test"
topic2="TUNC"
global veri
global deneme

global numara
numara=0

pin1="a"
pin2="b"
pin3="c"
pin4="d"
pinid='piniD'

zaman=datetime.datetime.now()
zaman2=str(zaman)

#ver tabanı kodları
con=sqlite3.connect("mqttizleme3.db")
cursor=con.cursor()
def tabloolustur():
cursor.execute("CREATE TABLE IF NOT EXISTS durumverisi(sira INT,zaman TEXT,pin1durum TEXT,pin2durum TEXT,pin3durum TEXT,pin4durum TEXT)")
def degerekle():
cursor.execute("INSERT INTO durumverisi('sira','zaman','pin1durum','pin2durum','pin3durum','pin4durum') VALUES('1','"+zaman2+"','"+pin1+"','"+pin2+"','"+pin3+"','"+pin4+"')")

    con.commit()

tabloolustur()
degerekle()
con.close()

def on_message(client, userdata,message):
global veri
global numara
print("received data is :")
veri=str(message.payload.decode("utf-8"))
print(str(veri) )
deneme=veri.split(":")
#a:1:b:2:c:3:d:4
print(deneme[1])
print(deneme[3])
print(deneme[5])
print(deneme[7])

#connect(host, port=1883, keepalive=60, bind_address="")
client= paho.Client()
client.on_message=on_message

client.username_pw_set(username="datax-pc",password="123")
client.connect(broker,15516,keepalive=60)

print("subscribing begins here")
client.subscribe(topic2)#subscribe topic TUNC

while True:
client.loop_forever() #contineously checking for message

time.sleep(3)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants