title: Firebase storage Upload file -python
body: <p>I need some help
  I am using python 3.6 to upload a file to firebase storage, but I couldn't get a reasonable result .</p>
  
  <pre><code>import firebase_admin
  from firebase_admin import credentials, firestore, storage
  
  cred=credentials.Certificate('C:\\Users\\blackturtle\\Envs\\tube\\ps.json')
  firebase_admin.initialize_app(cred, {
      'storageBucket': 'gs://dene-2ac17.appspot.com'
  })
  db = firestore.client()
  bucket = storage.bucket()
  blob = bucket.blob('hello.txt')
  outfile='C:\\Users\\blackturtle\\Envs\\tube\\hello.txt'
  blob.upload_from_filename(outfile)
  </code></pre>
  
  <p>That code gives this error below </p>
  
  <pre><code>Exception has occurred: google.api_core.exceptions.NotFound
  404 POST https://www.googleapis.com/upload/storage/v1/b/gs://dene-2ac17.appspot.com/o?uploadType=multipart: ('Request failed with status code', 404, 'Expected one of', &lt;HTTPStatus.OK: 200&gt;)
    File "C:\Users\blackturtle\Envs\tube\drive.py", line 27, in &lt;module&gt;
      blob.upload_from_filename(outfile)
  </code></pre>
  
  <p>When I change and use this code below to upload file </p>
  
  <pre><code>import firebase_admin
  from firebase_admin import credentials, firestore, storage
  
  cred=credentials.Certificate('C:\\Users\\blackturtle\\Envs\\tube\\ps.json')
  firebase_admin.initialize_app(cred, {
      'storageBucket': 'gs://dene-2ac17.appspot.com'
  })
  db = firestore.client()
  bucket = storage.bucket()
  blob = bucket.blob('hello.txt')
  outfile='C:\\Users\\blackturtle\\Envs\\tube\\hello.txt'
  with open(outfile, 'rb') as my_file:
      blob.upload_from_file(my_file)
  </code></pre>
  
  <p>Got this error</p>
  
  <pre><code>Exception has occurred: google.api_core.exceptions.NotFound
  404 POST https://www.googleapis.com/upload/storage/v1/b/gs://dene-2ac17.appspot.com/o?uploadType=resumable: ('Response headers must contain header', 'location')
    File "C:\Users\blackturtle\Envs\tube\drive.py", line 29, in &lt;module&gt;
      blob.upload_from_file(my_file)
  </code></pre>
  
  <p>Any idea what's going on? </p>
  
  <p>Thanks in advance </p>