<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pro-Tek Blog &#187; S3 BUCKET</title>
	<atom:link href="http://www.pro-tekconsulting.com/blog/category/s3-bucket/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pro-tekconsulting.com/blog</link>
	<description>For UI developers / UI designers and UI trends</description>
	<lastBuildDate>Thu, 05 Sep 2019 03:59:47 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.34</generator>
	<item>
		<title>HOW TO CHECK IF A KEY EXISTS IN S3 BUCKET USING BOTO3 ?</title>
		<link>http://www.pro-tekconsulting.com/blog/how-to-check-if-a-key-exists-in-s3-bucket-using-boto3-2/</link>
		<comments>http://www.pro-tekconsulting.com/blog/how-to-check-if-a-key-exists-in-s3-bucket-using-boto3-2/#comments</comments>
		<pubDate>Fri, 02 Feb 2018 02:45:16 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[S3 BUCKET]]></category>
		<category><![CDATA[BOTO3]]></category>

		<guid isPermaLink="false">http://www.pro-tekconsulting.com/blog/?p=2390</guid>
		<description><![CDATA[<p>How to check if a key exists in s3 bucket using boto3? import boto3 import botocore s3 = boto3.resource(&#8216;s3&#8242;) try: s3.Object(&#8216;my-bucket&#8217;, &#8216;dootdoot.jpg&#8217;).load() except botocore.exceptions.ClientError as e: if e.response[&#8216;Error&#8217;][&#8216;Code&#8217;] == &#8220;404&#8221;: # The object does not exist. &#8230; else: # Something else has gone wrong. raise else: # The object does exist.Load() does a HEAD request [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/how-to-check-if-a-key-exists-in-s3-bucket-using-boto3-2/">HOW TO CHECK IF A KEY EXISTS IN S3 BUCKET USING BOTO3 ?</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h4>How to check if a key exists in s3 bucket using boto3?</h4>
<p>import boto3<br />
import botocore</p>
<p>s3 = boto3.resource(&#8216;s3&#8242;)</p>
<p><strong>try:</strong><br />
 s3.Object(&#8216;my-bucket&#8217;, &#8216;dootdoot.jpg&#8217;).load()<br />
except botocore.exceptions.ClientError as e:<br />
    if e.response[&#8216;Error&#8217;][&#8216;Code&#8217;] == &#8220;404&#8221;:<br />
        # The object does not exist.<br />
        &#8230;<br />
    else:<br />
        # Something else has gone wrong.<br />
        raise<br />
else:<br />
    # The object does exist.Load() does a HEAD request for a single key, which is fast, even if the object in question is large or you have many objects in your bucket.</p>
<p>Of course, you might be checking if the object exists because you are planning on using it. If that is the case, you can just forget about the load() and do a get() or download_file() directly, then handle the error case.</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/how-to-check-if-a-key-exists-in-s3-bucket-using-boto3-2/">HOW TO CHECK IF A KEY EXISTS IN S3 BUCKET USING BOTO3 ?</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pro-tekconsulting.com/blog/how-to-check-if-a-key-exists-in-s3-bucket-using-boto3-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
