Skip to main content

Tinxy Package

Project description

Tinxy Package

Used for authenticating with tinxy.in

Usage

# pip install tinxy
# Python 3

import time
import base64
import requests
from tinxy import tinxy
import time

def encrypts(arg1, mqttpass):
    en_arg1 = tinxy.strToLongs(arg1.encode('utf-8').decode())
    en_mqttpass = tinxy.strToLongs(mqttpass.encode('utf-8').decode())
    ed = tinxy.encodes(en_arg1, en_mqttpass)
    ciphertext = tinxy.longsToStr(ed)
    cipherutf2 = ciphertext.encode('latin-1')
    cipherbase64 = base64.b64encode(cipherutf2)
    return base64.b64decode(cipherbase64).hex()

tm = str(int(time.time()))
data = encrypts(tm, "mqtt-password-here")

response = requests.post("http://10.0.28.17/toggle",  json={
    "password": data,
    "action": "1",
    "relayNumber": 2
})

print(response)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tinxy-0.2.5.tar.gz (7.8 kB view hashes)

Uploaded Source

Built Distribution

tinxy-0.2.5-py3-none-any.whl (6.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page