I am writing a client to enter the site, I have to send my login and password through POST . The problem is that the login name is "login" but the password is "pass" . Because of this, when you run the code, the python swears at pass (writes invalid syntax)

Swears on pass = in this line:

data = dict(email='Login', pass='Password' ) 


What is the way to show python that pass is not an operator , but a name ?

  • one
    Why not data = {'email': 'Login', 'pass': 'Password'} - andreymal

1 answer 1

You must use data = dict({'email': 'Login', 'pass': 'Password'})

Thanks for the answer in the andreymal comments!

  • And yet why not data = {'email': 'Login', 'pass': 'Password'} why do you need dict() : \ - andreymal
  • It is not the answer to the question. To leave your comments or ask the author to clarify, leave a comment to the appropriate post. - From check queue - MedvedevDev
  • one
    @MedvedevDev is certainly the answer. It should only erase dict (). Question: “how to write dict(pass=1) (which SyntaxError causes, since pass is reserved in Python”, the answer is {'pass': 1} - jfs