title: How to send an etag or last modified while making a request with aiohttp session.get
body: <ul>
  <li>I am loading multiple feed urls every minute</li>
  <li>I want to send a http get request, get 200 status code and full data if the data has changed since the last time I loaded it</li>
  <li>I want the http status code 304 and no response body if the data has not changed since the last time I loaded it</li>
  <li>Python feedparser offers <a href="https://pythonhosted.org/feedparser/http-etag.html#http-etag" rel="nofollow noreferrer">HERE</a> this functionality if I use their library to send GET requests</li>
  <li>How do I do this using aiohttp library</li>
  <li><p>How do I send etag and last modified in the GET request</p>
  
  <pre><code>async with session.get(url) as response:
      text = await response.text()
      print(response.headers.get('etag'), response.headers.get('Last-Modified'))
  </code></pre></li>
  </ul>
  
  <p>How do I send etag and last modified and simulate behavior similar to the library above?</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>Here is some detailed code</p>
  
  <pre><code>import asyncio
  import aiohttp
  
  async def load_feed(session, url):
      # Keep this an empty string for the first request
      etag = 'fd31d1100c6390bd8a1f16d2703d56c0'
      # Keep this an empty string for the first request
      last_modified='Mon, 11 May 2020 22:27:44 GMT'
      try:
          async with session.get(url, headers={'etag': etag, 'Last-Modified': last_modified}) as response:
              t = await response.text()
              print(response.headers.get('etag'), response.headers.get('Last-Modified'), response.status, len(t), response.headers)
      except Exception as e:
          print(e)
  
  async def load_feeds():
      try:
          async with aiohttp.ClientSession() as session:
              tasks = []
              for url in ['https://news.bitcoin.com/feed/']:
                  task = asyncio.ensure_future(load_feed(session, url))
                  tasks.append(task)
              await asyncio.gather(*tasks, return_exceptions=True)
      except:
          pass
  
  asyncio.get_event_loop().run_until_complete(load_feeds())
  </code></pre>
  
  <p><strong>Expectation:</strong></p>
  
  <ul>
  <li>Send a request the first time without headers</li>
  <li>Get a response code 200 with etag and Last-modified and full response</li>
  <li>Send a request again with etag and Last-modified</li>
  <li>Get a response code 304 with no response body</li>
  </ul>
  
  <p><strong>What is happening</strong>
  - I am getting status code 200 and full response body every time</p>
  
  <ul>
  <li>Tried a few other urls too like <a href="https://coindesk.com/feed" rel="nofollow noreferrer">https://coindesk.com/feed</a> </li>
  </ul>