Skip to content

TypeError: expected str, bytes or os.PathLike object, not BufferedReader #169

Open
@Phantom-Cass

Description

Not a bug, just an error I can't find a fix for

import pytumblr
import os

Authenticate via Tumblr API

client = pytumblr.TumblrRestClient(
"client key",
'client secret',
'0auth key',
'0auth secret',
)

Set the directory containing the photos to upload

photo_directory = 'folder/to/photos'

Iterate through the files in the directory

for filename in os.listdir(photo_directory):
if filename.endswith('.JPG'):
# Upload the photo to Tumblr
photo = open(photo_directory +"/"+ filename, 'rb')
response = client.create_photo('blog url', data=photo, tags=['photo dump'])
photo.close()
print("Did it.")

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