Skip to content

Instantly share code, notes, and snippets.

@deeTEEcee
Created March 5, 2019 17:39
Show Gist options
  • Save deeTEEcee/237196bbf5aebeaaba194d2028f8516f to your computer and use it in GitHub Desktop.
Save deeTEEcee/237196bbf5aebeaaba194d2028f8516f to your computer and use it in GitHub Desktop.
py-amqp examples
# Created these after looking at unit tests. Couldn't really find any other online examples.
from io import BytesIO
from amqp import Connection
import pprint
import pickle
connection = Connection()
channel = connection.channel()
message = channel.basic_get(queue='gegroby/ma.model.cycle.finalcal/analytics_finalcal/')
# channel.basic_ack(message.delivery_tag) acknowledge. otherwise, the same message will keep getting fetched at every attempt.
result = pickle.load(BytesIO(message.body))
pprint.pprint(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment