title: python asyncio & httpx
body: <p>I am very new to asynchronous programming and I was playing around with httpx.  I have the following code and I am sure I am doing something wrong - just don't know what it is.  There are two methods, one synchronous and other asynchronous.  They are both pull from google finance.  On my system I am seeing the time spent as following:</p>
  <p>Asynchronous: 5.015218734741211
  <br>
  Synchronous: 5.173618316650391</p>
  <p>Here is the code:</p>
  <pre><code>
  import httpx
  import asyncio
  import time
  
  
  
  #
  #--------------------------------------------------------------------
  #
  #--------------------------------------------------------------------
  #
  def sync_pull(url):
    r = httpx.get(url)
    print(r.status_code)
  
  
  #
  #--------------------------------------------------------------------
  #
  #--------------------------------------------------------------------
  #
  async def async_pull(url):
    async with httpx.AsyncClient() as client:
      r = await client.get(url)
      print(r.status_code)
  
  
  #
  #--------------------------------------------------------------------
  #
  #--------------------------------------------------------------------
  #
  if __name__ == &quot;__main__&quot;:
  
    goog_fin_nyse_url = 'https://www.google.com/finance/quote/'
    tickers = ['F', 'TWTR', 'CVX', 'VZ', 'GME', 'GM', 'PG', 'AAL', 
               'MARK', 'AAP', 'THO', 'NGD', 'ZSAN', 'SEAC',
               ]  
  
    print(&quot;Running asynchronously...&quot;)
    async_start = time.time()
    for ticker in tickers:
      url = goog_fin_nyse_url + ticker + ':NYSE'
      asyncio.run(async_pull(url))
    async_end = time.time()
    print(f&quot;Time lapsed is: {async_end - async_start}&quot;)
  
  
    print(&quot;Running synchronously...&quot;)
    sync_start = time.time()
    for ticker in tickers:
      url = goog_fin_nyse_url + ticker + ':NYSE'
      sync_pull(url)
    sync_end = time.time()
    print(f&quot;Time lapsed is: {sync_end - sync_start}&quot;)
  </code></pre>
  <p>I had hoped the asynchronous method approach would require a fraction of the time the synchronous approach is requiring.  What am I doing wrong?</p>