I can not get the value of the input "csrfmiddlewaretoken" from this link, could anyone help me? "The script would basically have to visit the page that is in the code and return the value of the input whose name is" csrfmiddlewaretoken "in the console
import requests as r
from bs4 import BeautifulSoup as bs
import time
import os
clear = lambda: os.system('cls')
req = r.get('https://www.udemy.com/join/login-popup/?ref=&display_type=popup&locale=pt_BR&response_type=json&next=https%3A%2F%2Fwww.udemy.com%2Fmobile%2Fipad%2F&xref=')
from bs4 import BeautifulSoup as bs
soup = bs(req.text, 'html.parser')
inp = soup.find('input', {'name': 'csrfmiddlewaretoken'})
val_inp = inp.get('value')
Error:
Traceback (most recent call last):
File "gg.py", line 18, in <module>
val_inp = inp.get('value')
AttributeError: 'NoneType' object has no attribute 'get'
On page:
<input type='hidden' name='csrfmiddlewaretoken' value='VyHNALqmdrUIRP72n3Yj8O8lsN0vfQwtsmzbCYbuTNDbtLR1sbg2Xk368y7U8M7d' />
The value changes every request / f5 / refresh