This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# encoding: iso-8859-1 | |
# encoding: win-1252 | |
import xmltodict as xd | |
import json | |
from limpa import limpa | |
def buscakey(recebe_id): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def photo_list(bot, update): | |
nomes = UsuarioTelegram.objects.all() | |
user = update.message.from_user.first_name | |
photo_file = bot.getFile(update.message.photo[-1].file_id) | |
#url = settings.MEDIA_ROOT + '/uploads' | |
url='/tmp' | |
print(url) | |
for a in nomes: | |
if a.nome == user: | |
imagefile=photo_file.download(custom_path=url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minimo = 100 | |
maximo = 1000 | |
lista_pali = [] | |
lista_resul = [] | |
for i in range(1, 999999): | |
num_str = str(i) | |
num_str_invertido = num_str[::-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
minimo = 100 | |
maximo = 1000 | |
lista_palidromo = [] | |
lista_resultado = [] | |
for i in range(1, 999999): | |
num_str = str(i) | |
num_str_invertido = num_str[::-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TagGeral(models.Model): | |
tag = models.CharField(max_length=50, verbose_name='Tag secundarias') | |
class Post(models.Model): | |
tag = models.ManyToManyField(TagGeral) | |
tag_lista = models.CharField(max_length=100, blank=True) | |
def get_tags(self): | |
tags = self.tag_lista.split(', ') | |
tag_geral = TagGeral.objects.all() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from locust import HttpLocust, TaskSet, task | |
import requests | |
class UserActions(TaskSet): | |
def login(self): | |
# login to the application | |
response = self.client.get('/auth/login') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Django==1.11 | |
python-telegram-bot==5.3.0 | |
telepot==10.5 | |
Pillow==4.3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class UserTelegram(models.Model): | |
name = models.CharField(max_length=50) | |
cod = models.CharField(max_length=50) | |
def __str__(self): | |
return self.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.management.base import BaseCommand | |
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters | |
from datetime import datetime | |
from bot.models import UserTelegram, Text, Image, Document | |
import os | |
from os.path import basename | |
from django.core.files import File | |
import tempfile | |
now = datetime.now() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.shortcuts import render | |
import telepot | |
from django.http import HttpResponseRedirect | |
from .models import * | |
bot = telepot.Bot('TOKEN HERE!!') | |
def page_send(request): | |
if request.method == 'GET': | |
user_located = UserTelegram.objects.all() |
OlderNewer