Skip to content

Commit 9aea158

Browse files
committed
add badges and interceptor snippet
1 parent 2ea792e commit 9aea158

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# oauth1-signer-python
22

3-
[![](https://img.shields.io/badge/license-MIT-yellow.svg)](https://github.com/Mastercard/oauth1-signer-java/blob/master/LICENSE)
3+
[![](https://travis-ci.org/MastercardDevs/oauth1-signer-python.svg?branch=master)](https://travis-ci.org/MastercardDevs/oauth1-signer-python)
4+
[![](https://sonarcloud.io/api/project_badges/measure?project=MastercardDevs_oauth1-signer-python&metric=alert_status)](https://sonarcloud.io/dashboard?id=MastercardDevs_oauth1-signer-python)
5+
[![](https://sonarcloud.io/api/project_badges/measure?project=MastercardDevs_oauth1-signer-python&metric=coverage)](https://sonarcloud.io/dashboard?id=MastercardDevs_oauth1-signer-python)
6+
[![](https://sonarcloud.io/api/project_badges/measure?project=MastercardDevs_oauth1-signer-python&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=MastercardDevs_oauth1-signer-python)
7+
[![](https://img.shields.io/pypi/v/mastercard-oauth1-signer.svg?style=flat&color=blue)](https://pypi.org/project/mastercard-oauth1-signer)
8+
[![](https://img.shields.io/badge/license-MIT-yellow.svg)](https://github.com/MastercardDevs/oauth1-signer-python/blob/master/LICENSE)
9+
410

511
## Table of Contents
612
- [Overview](#overview)
@@ -13,6 +19,7 @@
1319
* [Loading the Signing Key](#loading-the-signing-key)
1420
* [Creating the OAuth Authorization for a GET](#creating-the-oauth-get)
1521
* [Creating the OAuth Authorization for a POST](#creating-the-oauth-post)
22+
* [Complete code to use interceptors](#using-interceptors)
1623

1724

1825

@@ -110,3 +117,30 @@ print(r.text)
110117
```
111118

112119

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

Comments
 (0)