Skip to content

urequests - header dict not being passed through correctly? #314

@eymas

Description

@eymas

I'm at a loss regarding the following:

import urequests as requests
import ujson

method = "get"
url = "https://api.example.com"
headers = {
    "authorization": "Bearer" + token,
    "accept": "application/json"
    }
result = requests.request(method, url, headers)
result_obj = ujson.loads(result.json())

Looking at the request function within urequests.py, I believe I do have to pass a dictionary onto headers. However; the following is returned when I do so: TypeError: object with buffer protocol required

If I pass on the headers within the function call. I get a Bad Request error and no other way to read the response object to determine the exact cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions