Jump to content
Fórum Script Brasil
  • 0

web scraping

Charleston Senne da Silva


url  = ('https://tenda-api.stoomlab.com.br/api/public/store/category/12/products?query=%7B%22link%22:%22mercearia%22%7D&page={}&order=relevance&save=true')
html = request.urlopen(url).read()
soup = BeautifulSoup(html, 'lxml')
site_json = json.loads(soup.text)

for d in site_json['products']:
    if d.get('name') and d.get('price'):
        print(d.get('name'),'|','R$', d.get('price'))

if site_json['current_page'] <= 54:
    print('iniciando a contagem')
    cont = site_json['current_page'] + 1
    print('A contagem não foi iniciada')

por que deu esse erro:raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400:



Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...