python - What should be correct url-encoding of login data? -


i trying login interviewbit , download login protected page using cookies.

my code :

    urllib.request import build_opener, httpcookieprocessor     urllib.parse import urlencode     http.cookiejar import cookiejar       class interviewbit:         def __init__(self):             self.interviewbit_login_url = "https://www.interviewbit.com/users/sign_in/"             self.opener = none          def login(self, username, password):             cj = cookiejar()             self.opener = build_opener(httpcookieprocessor(cj))             login_data = urlencode({'user_email': username, 'user_password': password, 'user_remember_me': '1'})             # problem in line             binary_data = login_data.encode('utf-8')              self.opener.open(self.interviewbit_login_url, binary_data)             print("login successful")          def download(self, cat):             url = "https://www.interviewbit.com/search/?q%5b%5d=linkedin"             resp = self.opener.open(url)       client = interviewbit()     # enter interviewbit login credentials     client.login("my_email_id", "my_password")     client.download("lol") 
  • i can't send login_data string :

      self.opener.open(self.interviewbit_login_url, login_data) 
  • i tried utf-8 , ascii encoding, none of them worked. still getting unprocessable entity error : urllib.error.httperror: http error 422: unprocessable entity


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -