title: How do I directly save images from a url to my aws bucket (python / boto3)?
body: <p>I'm trying to create a python script to download images directly from a url to my AWS bucket. What I'm trying to do is akin to the code below:</p>
  <pre class="lang-py prettyprint-override"><code>import logging
  import boto3
  from botocore.exceptions import ClientError
  import os
  
  
  def url_to_bucket(url, bucket, object_name):
      &quot;&quot;&quot;Take the image from the URL and put it in a S3 bucket
  
      :param url: url to save image from
      :param bucket: Bucket to upload to
      :param object_name: S3 object name
      :return: True if file was uploaded, else False
      &quot;&quot;&quot;
  
      s3_client = boto3.client('s3')
      try:
          response = s3_client.download_from_url(url, bucket, object_name)
          # I'm mainly trying to get answers on how to do the line above
      except ClientError as e:
          logging.error(e)
          return False
      return True
  </code></pre>
  <p>But in the <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/index.html" rel="nofollow noreferrer">documentation for boto3</a>, I couldn't find anything close to it except for the <a href="https://boto3.amazonaws.com/v1/documentation/api/latest/guide/s3-uploading-files.html" rel="nofollow noreferrer">how to upload files</a>.</p>
  <p>The reason I want a method to do this is because I have a large csv filled with image urls from web scraping and I want to store them in my bucket. But I have McDonald's WiFi quality and as such, want to directly store the images in my AWS bucket instead of downloading it all on my PC and uploading it into my AWS bucket.</p>
  <p>Thanks!</p>