title: How to query Azure table storage using rest API
body: <p>i want to access my table in azure storage account. </p>
  
  <pre><code>import requests
  
  import hashlib
  
  import base64
  
  import hmac
  
  import datetime
  storageAccountName = 'rishistorage1234' # your storage account name
  storageKey='my-account-key'# your storage account access key
  url = 'https://' + storageAccountName + '.table.core.windows.net/table1'
  version = '2016-05-31' # x-ms-version
  date = datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")  #x-ms-date
  parameters = 'table1'
  CanonicalizedResources = '/' + storageAccountName + '/' + parameters
  CanonicalizedHeaders = 'x-ms-date:' + date 
  stringToSign = 'GET\n\n\n\n\n' + CanonicalizedHeaders + '\n' + CanonicalizedResources
  # note the b64decode of the storageKey
  signature = base64.b64encode(hmac.new(base64.b64decode(storageKey), 
  msg=stringToSign, digestmod=hashlib.sha256).digest())
  headers = {'x-ms-date': date,
       'x-ms-version': version,
         'Authorization': 'SharedKeyLite ' + storageAccountName + ':' + 
  signature}
  
  # send the request
  #print signature
  response = requests.get(url, headers=headers)
  print response
  print response.headers
  print response.content
  </code></pre>
  
  <p>sorry i was not able to copy everything as "code" and pls ignore the indentation error.
  the name of the table is table1
  the name of storage account is rishistorage1234
  Acces key 1 is <code>my-account-key</code>.</p>
  
  <p>the response i get is </p>
  
  <pre><code>    &lt;Response [403]&gt;
  {'Content-Length': '419', 'Access-Control-Expose-Headers': 'x-ms-request-id,Content-Length,Date,Transfer-Encoding', 'x-ms-request-id': 'e3b01b8c-0002-0024-0d3d-b71dc2000000', 'Server': 'Microsoft-HTTPAPI/2.0', 'Date': 'Mon, 17 Apr 2017 05:40:23 GMT', 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/xml'}
  &lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"&gt;&lt;m:code&gt;AuthenticationFailed&lt;/m:code&gt;&lt;m:message xml:lang="en-US"&gt;Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
  RequestId:e3b01b8c-0002-0024-0d3d-b71dc2000000
  Time:2017-04-17T05:40:24.3250398Z&lt;/m:message&gt;&lt;/m:error&gt;
  </code></pre>