How to do it - posting messages to an AWS queue

The 03/create_messages.py file contains code to read the planets data and to post the URL in the MoreInfo property to an SQS queue:

from urllib.request import urlopenfrom bs4 import BeautifulSoupimport boto3import botocore# declare our keys (normally, don't hard code this)access_key="AKIAIXFTCYO7FEL55TCQ"access_secret_key="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"# create sqs clientsqs = boto3.client('sqs', "us-west-2",                   aws_access_key_id = access_key,                    aws_secret_access_key = access_secret_key)# create / open the SQS queuequeue = sqs.create_queue(QueueName="PlanetMoreInfo")print (queue)# read and parse the planets HTMLhtml = urlopen("http://127.0.0.1:8080/pages/planets.html")bsobj = BeautifulSoup(html, ...

Get Python Web Scraping Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.