Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
AVPetukhov
Practica 2021
Commits
0838d64a
Commit
0838d64a
authored
Jul 11, 2021
by
MVMolchanova
Browse files
Upload New File
parent
bc0a7b20
Changes
1
Hide whitespace changes
Inline
Side-by-side
mainV3.py
0 → 100644
View file @
0838d64a
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment