Exemple #1
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__author__ = 'ipetrash'

from common import generate_request
from commands.command__weather_in_city.server import WeatherServer
from db import get_execute_command_url_server

url = get_execute_command_url_server(WeatherServer.guid)
command_name = 'погода'

import requests
rs = requests.post(url,
                   json=generate_request(command_name, command='Магнитогорск'))
print(rs.json())

rs = requests.post(url,
                   json=generate_request(command_name, command='Челябинск'))
print(rs.json())

rs = requests.post(url, json=generate_request(command_name, command='Москва'))
print(rs.json())

rs = requests.post(url,
                   json=generate_request(command_name, command='3421выаы:)'))
print(rs.json())

rs = requests.post(url, json=generate_request(command_name, command=''))
print(rs.json())
Exemple #2
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__author__ = 'ipetrash'

from common import generate_request
from commands.command__exchange_rate.server import ExchangeRateServer
from db import get_execute_command_url_server

url = get_execute_command_url_server(ExchangeRateServer.guid)
command_name = 'курс валют'

import requests
rs = requests.post(url, json=generate_request(command_name))
print(rs.json())

rs = requests.post(url,
                   json=generate_request(command_name=command_name,
                                         command='ok'))
print(rs.json())
Exemple #3
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__author__ = 'ipetrash'


from common import generate_request
from commands.command__calc.server import CalcServer
from db import get_execute_command_url_server

url = get_execute_command_url_server(CalcServer.guid)
command_name = 'калькулятор'


import requests
rs = requests.post(url, json=generate_request(command_name))
print(rs.json())

rs = requests.post(url, json=generate_request(command_name, command='2 + 2'))
print(rs.json())

rs = requests.post(url, json=generate_request(command_name, command='2 + 2 * 2'))
print(rs.json())

rs = requests.post(url, json=generate_request(command_name, command='10 ** 3'))
print(rs.json())

rs = requests.post(url, json=generate_request(command_name, command='sin(2 ** 10)'))
print(rs.json())

rs = requests.post(url, json=generate_request(command_name, command='(0xFF + 255) / 0b1010'))
Exemple #4
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__author__ = 'ipetrash'

from common import generate_request
from commands.command__fun.server import FunServer
from db import get_execute_command_url_server

url = get_execute_command_url_server(FunServer.guid)
command_name = 'насмеши'

import requests
rs = requests.post(url, json=generate_request(command_name))
print(rs.json())

rs = requests.post(url, json=generate_request(command_name, command='ok'))
print(rs.json())
Exemple #5
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__author__ = 'ipetrash'

import requests
import pathlib
from common import generate_request, create_attachment, FileAttachment, AttachmentType
from commands.command__get_image_info.server import GetImageInfoServer
from db import get_execute_command_url_server

url = get_execute_command_url_server(GetImageInfoServer.guid)
command_name = 'получить информацию о картинке'

FILE_NAME = 'example.jpg'

with open(FILE_NAME, 'rb') as f:
    content = f.read()
    extension = pathlib.Path(FILE_NAME).suffix[1:]

attachment = FileAttachment(content=content, extension=extension)
attachment_type = AttachmentType.IMAGE

rs = requests.post(url, json=generate_request())
print(rs.json())

rs = requests.post(url, json=generate_request(command_name))
print(rs.json())

rs = requests.post(url,
                   json=generate_request(command_name,