[Python] How do I send a POST request as a JSON?

Discussão em 'Python' iniciado por Stack, Junho 26, 2025.

  1. Stack

    Stack Membro Participativo

    data = {
    'ids': [12, 3, 4, 5, 6 , ...]
    }
    urllib2.urlopen("http://abc.example/api/posts/create",urllib.urlencode(data))


    I want to send a POST request, but one of the fields should be a list of numbers. How can I do that? (JSON?)

    Continue reading...

Compartilhe esta Página