title: Unable to use precedent function output as an input for the next function in scraping web content
body: <p>I have 2 functions, called GetItemIDlist (to scrape all idproduct of a shop on ecommerce site) and GetID_image (to get image gallary (about 8 images per product item) and store locally)</p>
  
  <p>Both of them works smoothly when run individually.</p>
  
  <p>But I do not know how to use the output of function 1, which gives a list of product IDs shown below, as an input for the looping process in function 2. </p>
  
  <p>Because Function 2, currently, has just been able to get image gallary if giving it an specific product id.</p>
  
  <p>So, I want to add a loop (using an output list generated by function 1) to get all image gallary of all product items, not by mannually keying an item id into function 2.</p>
  
  <p>Output of function 1:</p>
  
  <pre><code>1242118776
  1379832161
  2055592163
  bla bla
  1230767270
  </code></pre>
  
  <p>Function 1's script:</p>
  
  <pre><code>def GetItemIDList (shopid):
      i=0
      while i&lt;20:
          headers = {
              'User-Agent': 'Mozilla/5',
              'Referer': 'myrefererurl'
          }
          url = 'myAPIurl_pre'+str(shopid)+'myAPIurl_end'  
          r = requests.get(url, headers = headers, timeout= 5).json()
          for item in r['items']:
              itemid_list=item['itemid']
              print(itemid_list)
          i=i+1
  </code></pre>
  
  <p>Function 2 script:</p>
  
  <pre><code>def GetID_Image(item_id):
      headers = {
          'User-Agent': 'Mozilla/5',
          'Referer': 'myrefererheader'
      }   
      url = 'pre_myurl'+item_id+'end_myurl'
      r = requests.get(url, headers = headers, timeout= 5).json()
      itemid_shop=r['item']['itemid']
      itemname_shop=r['item']['name']
      print(itemname_shop)
      itemimage_shop=r['item']['images']
      endtag_image=range (11) #range(len(list(itemimage_shop))
      for imageid,i in zip(itemimage_shop,endtag_image):
          image_fronturl="myfronturl"
          image_fullurl=image_fronturl+imageid
          myfile = requests.get(image_fullurl, allow_redirects=True)
          open('mylocalfolder'+itemname_shop+'_'+str(i)+'.jpg', 'wb').write(myfile.content)
  </code></pre>
  
  <p>Pls take time to help me in this case, thanks so much!</p>