Skip to content

requests post json/multipart form-data and mitmproxy #4

@mixure

Description

@mixure
import requests as req
import json

proxy={'https':'172.16.3.96:8089',
'http':'172.16.3.96:8089'}
headers={'Content-Type':'application/json'}
url='https://httpbin.org/post'
r=req.post(url,data=json.dumps({'key':'value'}),
                headers=headers,proxies=proxy,
                verify='/Users/yeap/.mitmproxy/mitmproxy-ca-cert.cer')
print r.text

multipart/form-data

proxy={'https':'172.16.3.96:8089',
        'http':'172.16.3.96:8089'}

headers={'Content-Type':'multipart/form-data'}
url='https://httpbin.org/post'
r=req.post(url,files={'key':'value','key1':'value'},
                headers=headers,proxies=proxy,
                verify='/Users/yeap/.mitmproxy/mitmproxy-ca-cert.cer'
                )
print r.text

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions