Skip to content
  • 0 Votes
    1 Posts
    320 Views
    K
    Hi all, I'm trying to use the recently introduced WriteAPI to create topics and concurrently upload a file. I'm doing it via Python and I've already succeeded in create a simple topic without a file using something lilke payload = { "cid": cid, "title": title, "content": message } headers = { 'Authorization': 'Bearer '+nodebbToken, 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=json.dumps(payload)) but when it's about files using payload = { "cid": backstage_cid, "title": backstage_title, "content": backstage_message } headers = { 'Authorization': 'Bearer '+nodebbToken, 'Content-Type': 'multipart/form-data' } verifySSL = False print (payload) if (useFile): with open(backstage_file, 'rb') as f: response = requests.request("POST", url, headers=headers, data=payload, verify=verifySSL, files={backstage_file: f}) it returns Error: Required parameters were missing from this API call: cid, title, content cause passing the parameters in a plain dictionary rather than a JSON object seems not doable. The switch from JSON to dictionary is needed otherwise I wouldn't have been able to pass a file together with such header headers = { 'Authorization': 'Bearer '+nodebbToken, 'Content-Type': 'multipart/form-data' } Has anybody valuable suggestions here? Thanks in advance, Riccardo
  • Disable file upload entirely

    Solved Technical Support
    5
    0 Votes
    5 Posts
    2k Views
    baddingB
    It seems that there is still the possibility to upload a profile cover picture, even though I disable "upload images" in privileges for registered users.
  • Sending Files Through Chat

    Feature Requests
    5
    3 Votes
    5 Posts
    2k Views
    XiphX
    @julian said: I was looking into this with WebRTC. It's definitely doable As long as someone can make a plugin for that plugin that'll send all uploaded files through an online virus checker