0

I have an image loaded into a bytearray in a CircuitPython project, and I want to pass it to a POST request using the adafruit_requests library.

My code:

headers={
            'Content-Type': 'application/octet-stream',
            'Content-Length': str(frame_length),
            'Prediction-Key': prediction_key
        }

r = requests.request('POST', prediction_endpoint, data=buffer, headers=headers)

When I run this code, I get this error:

......Traceback (most recent call last):
  File "code.py", line 85, in <module>
  File "adafruit_requests.py", line 242, in request
  File "adafruit_requests.py", line 224, in request
TypeError: wrong number of arguments

I cannot for the life of me figure out why! Whats the correct way to send a bytearray as an octet stream to a POST request using CircuitPython?

I've looked at the code in the Adafruit requests repo and the line numbers don't match up with the code, so I don't know what's causing the issue.

1 Answer 1

0

It looks like it is an error in the adafruit_requests library in CircuitPython. I've raised an issue and PR to fix it:

https://github.com/adafruit/Adafruit_CircuitPython_Requests/issues/20

https://github.com/adafruit/Adafruit_CircuitPython_Requests/pull/21

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.