SyntaxError: non-keyword arg after keyword arg Error in Python when using requests.post()

SyntaxError: non-keyword arg after keyword arg Error in Python when using requests.post()

Try:

response = requests.post(http://api.bf3stats.com/pc/player/, opt, data=player)

You cannot put a non-keyword argument after a keyword argument.

Take a look at the docs at http://docs.python.org/2.7/tutorial/controlflow.html?highlight=keyword%20args#keyword-arguments for more info.

It should be something like this:

response = requests.post(http://api.bf3stats.com/pc/player/, data=player, options=opt)

Because you can not pass a non-keyword argument (opt) after a keyword argument (data=player).

SyntaxError: non-keyword arg after keyword arg Error in Python when using requests.post()

Leave a Reply

Your email address will not be published. Required fields are marked *