Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

References in code to "payload" where does it come from? #1

Open
johncblacker opened this issue Apr 4, 2021 · 0 comments
Open

References in code to "payload" where does it come from? #1

johncblacker opened this issue Apr 4, 2021 · 0 comments

Comments

@johncblacker
Copy link

I'm trying to take advantage of your code in a uPy program to push an image to pushbullet and have been trying to understand your code in order to adapt it for my purposes. I tried calling the uploader.py "make_request" function with the output from my first call to pushbullet which obtains the url used to upload among other things. Here's my output from that call:


upload_url : https://upload.pushbullet.com/upload-legacy/EJz498Ega15yxUIPviAP7J6JlttKEbXb
data : {'key': 'Z6bJNYKElcJeappWL52cNGXutU1U1aYO/jetfire40.jpg', 'awsaccesskeyid': 'AKIAJJIUQPUDGPM4GD3W', 'acl': 'public-read', 'policy': 'eyKjb25kaXRpb25zIjTE6MzcuMjM0MTMwWiJ9', 'signature': 'UX5s1uIy1ov6+xlj58JY7rGFKcs=', 'content-type': 'image/jpeg'}
file_url : https://dl3.pushbulletusercontent.com/Z6bJNYKElcJeappWL52cNGXutU1U1aYO/jetfire40.jpg
file_type : image/jpeg
file_name : jetfire40.jpg


When I call the make_request function thusly:

respd = json.loads(resp.text)
for key, value in respd.items():
print(key, ' : ', value)
data, headers = make_request(data=respd, image='jetfire40.jpg')
<<<<<<<<<<<<<<<<<<<<<<<<<<
I get an error:
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
TypeError: join expects a list of str/bytes objects consistent with self object
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
But, I'm sure it's because I don't understand the semantics of your code. Can you help? I'm using urequests and therefore have to pass it a multipart/form-data as I understand it because urequests doesn't support the "files" parameter that requests does.
Thanks for any help you can provide. FWIW, pushbullet's api doc is fairly useless in figuring things out.

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

No branches or pull requests

1 participant