Skip to content

Conversation

fschmi
Copy link

@fschmi fschmi commented Oct 4, 2018

Attempt number 2. Fixed some major bugs.

@tongclement
Copy link

Hello. I am doing a urequest with basic auth with the latest version of MicroPython in 2020. It is telling me that the keyword 'auth' is unexpected. It is a post request:

res = urequests.post(request_url, headers={'content-type': 'application/json'}, data=post_data, auth=('username','password')).json()
        print(res.text)

Is this not implemented?
Thank you very much for your kind help in advance @fschmi

@tongclement
Copy link

@fschmi

@andrewleech
Copy link
Contributor

Hi, a version of this PR has been merged in #500, commit e7e8eff.

@fschmi I hope you don't mind, I maintained your authorship on the commit even though I changed the code slightly based on review comments.

  • replace <str>.decode() with str(<str>, "ascii") as not all ports have the decode functione enabled.
  • inline the encode_basic_auth function into an inline block - while the function is arguably clearer to read it results in slightly larger bytecode, the inline version saves flash/ram.

@andrewleech andrewleech closed this Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants