Skip to content

Need a way to add a parameter when using POST with no form #82

Open
@portante

Description

@portante

It would be helpful to have a way to add a parameter to the authorization header when POSTing with no form body.

For example, imagine a world where somebody would like to be able to have his (or her) POST body contain an XML payload, but still add a parameter to the authorization header:

POST /servic/tokens/temp HTTP/1.1
Host: 192.168.1.2
Accept-Encoding: identity
Content-Length: 11
content-type: text/xml
authorization: OAuth realm="https://192.168.1.2", oauth_body_hash="ytIINryy7%2FaoD1bdgNnDBD0GAEHifo%3D", oauth_nonce="929257241", oauth_timestamp="131208533215", oauth_consumer_key="112723bd7a6e76102d92b0123134563df6", oauth_signature_method="PLAINTEXT", oauth_version="1.0", oauth_signature="1127bda2-6e76-102d-92b0-12123126%26", oauth_callback="url"
user-agent: Python-httplib2/$Rev$

<xml>...</xml>

So if she (or he) used a client request as follows, she (or he, well if he is a she, this is not a problem) would have no way to add the "oauth_callback" to the authorization header, since you can only add those via a form post body:

client = oauth.Client(...)
resp, content = client.request(request_token_url, method="POST", headers={'Content-Type':'text/xml'}, body='<xml>...</xml>')

Perhaps we could add a parameters parameter to the request method of Client, so that non-form POSTs can still add those parameters to the authorization header:

client = oauth.Client(...)
resp, content = client.request(request_token_url, method="POST", headers={'Content-Type':'text/xml'}, body='<xml>...</xml>', parameters=dict(oauth_callback='url'))

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions