|
1 | 1 | # oauth1-signer-python |
2 | 2 |
|
3 | | -[](https://github.com/Mastercard/oauth1-signer-java/blob/master/LICENSE) |
| 3 | +[](https://travis-ci.org/MastercardDevs/oauth1-signer-python) |
| 4 | +[](https://sonarcloud.io/dashboard?id=MastercardDevs_oauth1-signer-python) |
| 5 | +[](https://sonarcloud.io/dashboard?id=MastercardDevs_oauth1-signer-python) |
| 6 | +[](https://sonarcloud.io/dashboard?id=MastercardDevs_oauth1-signer-python) |
| 7 | +[](https://pypi.org/project/mastercard-oauth1-signer) |
| 8 | +[](https://github.com/MastercardDevs/oauth1-signer-python/blob/master/LICENSE) |
| 9 | + |
4 | 10 |
|
5 | 11 | ## Table of Contents |
6 | 12 | - [Overview](#overview) |
|
13 | 19 | * [Loading the Signing Key](#loading-the-signing-key) |
14 | 20 | * [Creating the OAuth Authorization for a GET](#creating-the-oauth-get) |
15 | 21 | * [Creating the OAuth Authorization for a POST](#creating-the-oauth-post) |
| 22 | + * [Complete code to use interceptors](#using-interceptors) |
16 | 23 |
|
17 | 24 |
|
18 | 25 |
|
@@ -110,3 +117,30 @@ print(r.text) |
110 | 117 | ``` |
111 | 118 |
|
112 | 119 |
|
| 120 | + |
| 121 | +##### Complete snippet to use interceptors : <a name="using-interceptors"></a> |
| 122 | + |
| 123 | +``` python |
| 124 | + signing_key = authenticationutils.load_signing_key('your-keyFile.p12', 'the-keystore-password') |
| 125 | + consumer_key = 'your-consumer-key-from-developer.mastercard.com' |
| 126 | + |
| 127 | + baseUrl = 'https://sandbox.api.mastercard.com' |
| 128 | + |
| 129 | + service_cli = APIClientYourService() |
| 130 | + add_signing_layer(self, service_cli, key_file, key_password, consumer_key) |
| 131 | + |
| 132 | + queryMap = { |
| 133 | + "Format": "JSON", # change this to toggle between and XML or JSON response |
| 134 | + "fxDate": "2016-09-30", |
| 135 | + "transCurr": "ALL", |
| 136 | + "crdhldBillCurr": "DZD", |
| 137 | + "bankFee": "5", |
| 138 | + "transAmt": "23" |
| 139 | + } |
| 140 | + |
| 141 | + uri = baseUrl + "/settlement/currencyrate/conversion-rate" |
| 142 | + |
| 143 | + r = test_cli.request('GET', uri, query_params=queryMap) |
| 144 | + print(r.text) |
| 145 | + |
| 146 | +``` |
0 commit comments