0

I need to fill a form of an HTML to then scrap the results from this. I've got the following code (python 3.6)

import urllib
import urllib.request

url = "https://www.situacaocadastral.com.br"
data = urllib.parse.urlencode({'doc': 3984782000139}).encode("utf-8")
results=urllib.request.urlopen(url, data)

print(results.read())

From inspection I know that the form name is 'doc' and I'm trying to pass the query 3984782000139.

At this stage I'm getting the following error:

HTTPError: HTTP Error 403: Forbidden

Any ideas what is going on and how to fix it?

Juan Castaño
  • 67
  • 3
  • 11

0 Answers0