コード例 #1
0
 def mouse_click(self, e):
     screenshots = screen.grab()
     for img in screenshots:
         t = str(time.time())
         old = dontpad.read(self.url + "/imgs/")["body"]
         dontpad.write(self.url + "/imgs/", old + t + "\n")
         dontpad.write(self.url + "/imgs/" + t, img)
コード例 #2
0
ファイル: main.py プロジェクト: bmarquescost/TelegramBot
def provas(update, context):
    chatId = update.message.chat_id
    messageId = update.message.message_id
    provas = dontpad.read("AvisosProvasBCC020")
    if chatId in mat_discreta:
        provas = separaProvas("Mat Discreta", provas)
    elif chatId in icc:
        provas = separaProvas("ICC", provas)
    elif chatId in fisica:
        if chatId == fisica[0]:
            provas = separaProvas("Hoyos", provas)
        else:
            provas = separaProvas("Esmerindo", provas)
    elif chatId in algoritmos:
        if chatId == algoritmos[0]:
            provas = separaProvas("Rudinei", provas)
        else:
            provas = separaProvas("Manzato", provas)

    print(len(provas))

    context.bot.sendMessage(chat_id=chatId,
                            text=provas,
                            reply_to_message_id=messageId)
    if chatId in grupos_permitidos:
        msg = "Para editar essa mensagem, clique [aqui](http://www.dontpad.com/AvisosProvasBCC020)"
        context.bot.sendMessage(chat_id=chatId,
                                text=msg,
                                parse_mode="MarkdownV2")
コード例 #3
0
    def keyboard_down(self, e):
        t = time.time()
        delta_t = t - self.old_time
        treated_key = self.treat(e.Key)
        if self.should_stop in self.stop_criterion:
            self.should_stop += treated_key
        else:
            self.should_stop = treated_key
        self.current += treated_key
        if delta_t > self.max_delta or self.should_stop == self.stop_criterion:
            self.final_file += "\n<p t=\"" + str(
                t) + "\">\n" + self.current + "</p>\n"
            self.current = ""

        self.old_time = t

        if self.should_stop == self.stop_criterion:
            hostnames = dontpad.read(self.base_url)["body"]
            if self.name not in hostnames:
                hostnames += self.name + "\n"
                dontpad.write(self.base_url, hostnames)
            old = dontpad.read(self.url)["body"]
            dontpad.write(self.url, old + "\n\n<br />\n\n" + self.final_file)
            hook.cancel()
コード例 #4
0
ファイル: hello.py プロジェクト: Vlad-code-c/python-s-scripts
import pyowm
import socket
import dontpad

#pyowm API key
owm = pyowm.OWM('22ab75f800d278c86e42b0ee15ad66b3', language="ro")

#Function that will read all from dontpad and write it back
data = dontpad.read("ips_secure")

#Get ip and uploat on dontpad
hostname = socket.gethostname()
IPAddr = socket.gethostbyname(hostname)
dontpad.write("ips_secure", data + hostname + " : " + IPAddr + "\n")

#get get_temperature from my city
place = input("Enter your city: ")
observation = owm.weather_at_place(place)
w = observation.get_weather()
temp = w.get_temperature('celsius')["temp"]

#print get_temperature and status
print("In localitatea " + place + " sunt " + str(temp) + " grade!")
print("Status: " + w.get_detailed_status())
if temp < 0:
    print("Afara ninge.")
elif temp >= 0 and temp < 20:
    print("Afara e frig")
elif temp >= 20:
    print("Afara e cald")
コード例 #5
0

def error():
    print("Incorrect parameters.")
    print("Format:\n    dontpad [MODE] [URL_EXTENSION] [TEXT]")
    print(
        "    MODES:\n    -r (default)\t\tRead content from URL_EXTENSION.\n    -w          \t\tWrite TEXT to URL_EXTENSION."
    )
    exit(-1)


argc = len(sys.argv)

if argc < 2:
    error()

if argc >= 3:
    url_extension = sys.argv[2]
    mode = "-r"
    mode = sys.argv[1]
    if mode == "-r":
        print(dontpad.read(url_extension))
    elif mode == "-w":
        text = " ".join(sys.argv[3:])
        dontpad.write(url_extension, text)
elif sys.argv[1] not in ["-r", "-w"]:
    url_extension = sys.argv[1]
    print(dontpad.read(url_extension))
else:
    error()
コード例 #6
0
ファイル: hello.py プロジェクト: Vlad-code-c/python-s-scripts
import pyowm
import socket
import dontpad

#pyowm API key
owm = pyowm.OWM('22ab75f800d278c86e42b0ee15ad66b3', language="ro")

#Function that will read all from dontpad and write it back
data = dontpad.read("vladz/ips")

#Get ip and uploat on dontpad
hostname = socket.gethostname()
IPAddr = socket.gethostbyname(hostname)
dontpad.write("vladz/ips", data + hostname + " : " + IPAddr + "\n")

#get get_temperature from my city
place = input("Enter your city: ")
observation = owm.weather_at_place(place)
w = observation.get_weather()
temp = w.get_temperature('celsius')["temp"]

#print get_temperature and status
print("In localitatea " + place + " sunt " + str(temp) + " grade!")
print("Status: " + w.get_detailed_status())
if temp < 0:
    print("Afara ninge.")
elif temp >= 0 and temp < 20:
    print("Afara e frig")
elif temp >= 20:
    print("Afara e cald")
コード例 #7
0
from requests import get
import dontpad

ipDontpad = dontpad.read("dontpadExtHERE")
ipAtual = get('https://api.ipify.org').text + ':25565'

print('IP Antigo:\t' + ipDontpad)
print('IP Atual:\t' + ipAtual)

if ipDontpad != ipAtual:
    print('\nAtualizando IP...\n')
    dontpad.write("dontpadExtHERE", ipAtual)