How does a bot post with an image+thumb? #28

Closed
opened 2022-11-28 20:26:51 +00:00 by GeneralHurricane · 1 comment

Trying this (file is the python file-like object, mime is 'image/jpeg'):

  headers = {"Authorization": API_KEY}
  url="https://rdrama.net/h/dankchristianmemes/submit"
  files = { 'file': (filename, file, mime) }
  values = { 'title': title , 'sub': 'dankchristianmemes' }
  r=requests.post(url, headers=headers, files=files, data=values)

It correctly posts and adds the image to the body of the post, but the resulting gets the default marsey-yawn thumbnail. It looks like maybe it needs the file-url - is that just the same image or should I format it first? Is it a dictionary entry part of files?

Trying this (`file` is the python file-like object, `mime` is 'image/jpeg'): ``` headers = {"Authorization": API_KEY} url="https://rdrama.net/h/dankchristianmemes/submit" files = { 'file': (filename, file, mime) } values = { 'title': title , 'sub': 'dankchristianmemes' } r=requests.post(url, headers=headers, files=files, data=values) ``` It correctly posts and adds the image to the body of the post, but the resulting gets the default marsey-yawn thumbnail. It looks like maybe it needs the `file-url` - is that just the same image or should I format it first? Is it a dictionary entry part of `files`?
justcool393 added the
help wanted
label 2022-11-29 03:59:05 +00:00

ok apparently it is just file-url and file can be empty

with open(CHOOSE_FROM + filename, mode='rb') as file:                                             headers = {"Authorization": API_KEY}            url="https://rdrama.net/h/dankchristianmemes/submit"                                            files = { 'file-url': (filename, file, mime) }  values = { 'title': title , 'sub': 'dankchristianmemes' }                                       r=requests.post(url, headers=headers, files=files, data=values)

https://rdrama.net/h/dankchristianmemes/post/127228/meme-a-day-for-advent-in

ok apparently it is just `file-url` and `file` can be empty ``` with open(CHOOSE_FROM + filename, mode='rb') as file: headers = {"Authorization": API_KEY} url="https://rdrama.net/h/dankchristianmemes/submit" files = { 'file-url': (filename, file, mime) } values = { 'title': title , 'sub': 'dankchristianmemes' } r=requests.post(url, headers=headers, files=files, data=values) ``` https://rdrama.net/h/dankchristianmemes/post/127228/meme-a-day-for-advent-in
Sign in to join this conversation.
There is no content yet.