Commit 0838d64a authored by MVMolchanova's avatar MVMolchanova
Browse files

Upload New File

parent bc0a7b20
import pika
import math
import json
credentials = pika.PlainCredentials('Anton', 'Anton')
connection = pika.BlockingConnection(pika.ConnectionParameters(host='217.9.89.214', port=5672, virtual_host='/', credentials=credentials))
channel = connection.channel()
channel.queue_declare(queue='Anton')
def f(x):
return math.pow(x,2)
parcel = []
def Messages():
for x in range(151):
data = dict()
x = x-50
y = f(x)
data['x'] = x
data['y'] = y
parcel.append(data)
return json.dumps(parcel)
message = Messages()
print(message)
channel.basic_publish(exchange='', routing_key='Anton', body=message)
print("Sent")
connection.close()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment