File: getResources2.cpp

package info (click to toggle)
qoauth 2.0.1~1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 452 kB
  • sloc: cpp: 1,619; ansic: 11; sh: 10; makefile: 6
file content (19 lines) | stat: -rw-r--r-- 831 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
QByteArray url( "http://example.com/get_photo" );
// create a request parameters map
QOAuth::ParamMap map;
map.insert( "file", "flower_48.jpg" );
map.insert( "size", "small" );

// construct the authorization header
QByteArray header =
    qoauth->createParametersString( requestUrl, QOAuth::GET, QOAuth::HMAC_SHA1,
                                    token, tokenSecret, map,
                                    QOAuth::ParseForHeaderArguments );
// append parameters string to the URL
// alternatively you can use QOAuth::ParseForRequestContent if you want
// to use the output as a POST request content (remember then of passing
// QOAuth::POST above).
url.append( qoauth->inlineParameters( map, QOAuth::ParseForInlineQuery ) );
QNetworkRequest request( QUrl( url ) );
request.setRawHeader( "Authorization", header );
// etc...