title: get Specify value from html with python beautifulsoup
body: <p>Im new in <strong>scraping</strong>,
  And am doing some <strong>scraping</strong> project and I trying to get value from the Html Below:</p>
  <pre><code>&lt;div class=&quot;buttons_zoom&quot;&gt;&lt;div class=&quot;full_prod&quot;&gt;&lt;a href=&quot;javascript:void(0)&quot; onclick=&quot;js:getProdID('https://www.XXXXXXX.co.il','{31F93B1D-449F-4AD7-BFB0-97A0A8E068F6}','379104')&quot; title=&quot;לחם אחיד פרוס אנג'ל 750 גרם - פרטים נוספים&quot;&gt;&lt;img alt=&quot;פרטים נוספים&quot; border=&quot;0&quot; src=&quot;template/images/new_site/icon-view-prod-cartpage.png&quot;/&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;
  </code></pre>
  <p>i want to get this value :
  379104
  which located in onclick
  im using BeautifulSoup
  The code:</p>
  <pre><code> for i in page_content.find_all('div', attrs={'class':'prodPrice'}):
              temp = i.parent.parent.contents[0]
  </code></pre>
  <p>temp return list of objects and temp= to the Html Above
  can someone help to extract this id
  thanks!!</p>
  <p>Edit******
  Wow guys thanks for amazing explanation!!!!!  but i have 2 issues 1.retry mechanism that no working i set it to timeout=1 in order to make it fail but once its fail its return:</p>
  <pre><code>requests.exceptions.RetryError: HTTPSConnectionPool(host='www.XXXXX.il', port=443): Max retries exceeded with url: /default.asp?catid=%7B2234C62C-BD68-4641-ABF4-3C225D7E3D81%7D (Caused by ResponseError('too many redirects',)) 
  </code></pre>
  <p>can you please help me with retry mechanism code below : 2. perfromance issues witout the retry mechanism when im set timeout=6 <strong>scraping</strong> duration of 8000 items taking 15 minutes how i can improve this code performance ? Code below:</p>
  <pre><code>def get_items(self, dict):
          itemdict = {}
          for k, v in dict.items():
              boolean = True
          # here, we fetch the content from the url, using the requests library
              while (boolean):
               try:
                  a =requests.Session()
                  retries = Retry(total=3, backoff_factor=0.1, status_forcelist=[301,500, 502, 503, 504])
                  a.mount(('https://'), HTTPAdapter(max_retries=retries))
                  page_response = a.get('https://www.XXXXXXX.il' + v, timeout=1)
               except requests.exceptions.Timeout:
                  print  (&quot;Timeout occurred&quot;)
                  logging.basicConfig(level=logging.DEBUG)
               else:
                   boolean = False
  
              # we use the html parser to parse the url content and store it in a variable.
              page_content = BeautifulSoup(page_response.content, &quot;html.parser&quot;)
              for i in page_content.find_all('div', attrs={'class':'prodPrice'}):
                  parent = i.parent.parent.contents[0]
                  getparentfunc= parent.find(&quot;a&quot;, attrs={&quot;href&quot;: &quot;javascript:void(0)&quot;})
                  itemid = re.search(&quot;.*'(\d+)'.*&quot;, getparentfunc.attrs['onclick']).groups()[0]
                  itemName = re.sub(r'\W+', ' ', i.parent.contents[0].text)
                  priceitem = re.sub(r'[\D.]+ ', ' ', i.text)
                  itemdict[itemid] = [itemName, priceitem]
  </code></pre>