title: Read a csv file from aws s3 using boto and pandas
body: <p>I have already read through the answers available <a href="https://stackoverflow.com/questions/30818341/how-to-read-a-csv-file-from-an-s3-bucket-using-pandas-in-python">here</a> and <a href="https://stackoverflow.com/questions/28618468/read-a-file-line-by-line-from-s3-using-boto">here</a> and these do not help.</p>
  
  <p>I am trying to read a <code>csv</code> object from <code>S3</code> bucket and have been able to successfully read the data using the following code. </p>
  
  <pre><code>srcFileName="gossips.csv"
  def on_session_started():
    print("Starting new session.")
    conn = S3Connection()
    my_bucket = conn.get_bucket("randomdatagossip", validate=False)
    print("Bucket Identified")
    print(my_bucket)
    key = Key(my_bucket,srcFileName)
    key.open()
    print(key.read())
    conn.close()
  
  on_session_started()
  </code></pre>
  
  <p>However, if I try to read the same object using pandas as a data frame, I get an error. The most common one being <code>S3ResponseError: 403 Forbidden</code></p>
  
  <pre><code>def on_session_started2():
    print("Starting Second new session.")
    conn = S3Connection()
    my_bucket = conn.get_bucket("randomdatagossip", validate=False)
    #     url = "https://s3.amazonaws.com/randomdatagossip/gossips.csv"
    #     urllib2.urlopen(url)
  
    for line in smart_open.smart_open('s3://my_bucket/gossips.csv'):
       print line
    #     data = pd.read_csv(url)
    #     print(data)
  
  on_session_started2()
  </code></pre>
  
  <p>What am I doing wrong? I am on python 2.7 and cannot use Python 3.</p>