Skip to content

Commit

Permalink
Adiciona user agent (bypass block?)
Browse files Browse the repository at this point in the history
  • Loading branch information
j committed Feb 6, 2023
1 parent 2c8d2c3 commit 74d45b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions SISU_Scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import re
import sys
from constants import estados
import datetime

user_agent = {'User-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0'}


def get_info(dados, numero):
Expand All @@ -12,7 +15,7 @@ def get_info(dados, numero):


def get_cortes(codigo):
r=requests.get(f'https://sisu-api-pcr.apps.mec.gov.br/api/v1/oferta/{codigo}/modalidades')
r=requests.get(f'https://sisu-api-pcr.apps.mec.gov.br/api/v1/oferta/{codigo}/modalidades', headers = user_agent)
data = r.json()

out = []
Expand All @@ -39,7 +42,7 @@ def formata(sigla, dicionario):
except IndexError:
curso_id = 37 # Default é medicina

r = requests.get(f'https://sisu-api-pcr.apps.mec.gov.br/api/v1/oferta/curso/{curso_id}')
r = requests.get(f'https://sisu-api-pcr.apps.mec.gov.br/api/v1/oferta/curso/{curso_id}', headers = user_agent)
dados = r.json()
output = []
for i in dados.keys():
Expand Down

0 comments on commit 74d45b0

Please sign in to comment.