Skip to content

Commit ef2cb8b

Browse files
committed
Fix warnings in python code
1 parent 023e090 commit ef2cb8b

File tree

3 files changed

+32
-16
lines changed

3 files changed

+32
-16
lines changed

catalog/numberverification/samplecode_numberverification.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ As the opposite to the flow triggering, this API consumption flow will always co
110110
Samples represent how to publish the callback URL in Python or Node.js, so the code from the Auth Code Flow can be received. The same can be achieved in any other language with capabilities to run an HTTP server and listen for the redirect from the authentication flow:
111111

112112
```python Sandbox SDK for Python
113-
from flask import Flask, request, jsonify
113+
from flask import Flask, request
114114
from opengateway_sandbox_sdk import ClientCredentials, NumberVerification
115115

116116
credentials = ClientCredentials(
@@ -120,6 +120,7 @@ credentials = ClientCredentials(
120120

121121
app = Flask(__name__)
122122

123+
123124
@app.route('/numberverification-callback', methods=['GET'])
124125
def callback():
125126
code = request.args.get('code', '')
@@ -153,7 +154,7 @@ app.listen(port, () => {
153154
})
154155
```
155156
```python Sample SDK for Python
156-
from flask import Flask, request, jsonify
157+
from flask import Flask, request
157158
from aggregator_opengateway_sdk import ClientCredentials, NumberVerification
158159

159160
credentials = ClientCredentials(
@@ -163,6 +164,7 @@ credentials = ClientCredentials(
163164

164165
app = Flask(__name__)
165166

167+
166168
@app.route('/numberverification-callback', methods=['GET'])
167169
def callback():
168170
code = request.args.get('code', '')
@@ -195,7 +197,9 @@ app.listen(port, () => {
195197
})
196198
```
197199
```python Sample HTTP using Python
198-
from flask import Flask, request, jsonify
200+
import base64
201+
import requests
202+
from flask import Flask, request
199203

200204
client_id = "my-app-id"
201205
client_secret = "my-app-secret"
@@ -205,6 +209,7 @@ api_purpose = "dpv:FraudPreventionAndDetection#number-verification-verify-read"
205209

206210
app = Flask(__name__)
207211

212+
208213
@app.route('/numberverification-callback', methods=['GET'])
209214
def callback():
210215
code = request.args.get('code', '')

catalog/qod/samplecode_qod.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ credentials = ClientCredentials(
7575
clientsecret='my-app-secret'
7676
)
7777

78-
device_ip_address = self.get_device_ip() # e.g. '203.0.113.25:8080'
78+
device_ip_address = self.get_device_ip() # e.g. '203.0.113.25:8080'
7979

8080
qod_client = QoDMobile(client=credentials, ip_address=device_ip_address)
8181
```
@@ -205,10 +205,13 @@ JSONObject jsonResponse = new JSONObject(response.body());
205205
String accessToken = jsonResponse.getString("access_token");
206206
```
207207
```python Sample HTTP using Python
208+
import base64
209+
import json
210+
import requests
208211
# First step:
209212
# Perform an authorization request
210213

211-
device_ip_address = self.get_device_ip() # e.g. '203.0.113.25:8080'
214+
device_ip_address = get_device_ip() # e.g. '203.0.113.25:8080'
212215

213216
client_id = "my-app-id"
214217
client_secret = "my-app-secret"
@@ -267,12 +270,12 @@ const duration = 300 // Seconds
267270
qodClient.setQualityOfService(duration, QoSProfiles.QOS_E)
268271
```
269272
```java Sample SDK for Java
270-
int duration = 300; // Seconds
273+
int duration = 300; // Seconds
271274

272275
qodClient.setQualityOfService(duration, QoSProfiles.QOS_E);
273276
```
274277
```python Sample SDK for Python
275-
duration = 300 # Seconds
278+
duration = 300 # Seconds
276279

277280
qod_client.set_quality(duration, QoSProfiles.QOS_E)
278281
```
@@ -481,7 +484,7 @@ app.listen(port, () => {
481484
})
482485
```
483486
```python Sample SDK for Python
484-
from flask import Flask, request, jsonify
487+
from flask import Flask, request
485488
from aggregator_opengateway_sdk import ClientCredentials, QoDMobile, QoSProfiles
486489

487490
credentials = ClientCredentials(
@@ -491,6 +494,7 @@ credentials = ClientCredentials(
491494

492495
app = Flask(__name__)
493496

497+
494498
@app.route('/qod-auth-callback', methods=['GET'])
495499
def auth_callback():
496500
code = request.args.get('code', '')
@@ -524,10 +528,10 @@ For that, still in the code of the auth callback URL endpoint listener, followin
524528
console.log(result)
525529
```
526530
```python Sample SDK for Python
527-
ip = request.remote_addr
528-
port = request.environ.get('REMOTE_PORT')
531+
ip = request.remote_addr
532+
port = request.environ.get('REMOTE_PORT')
529533

530-
qod_client.set_quality(300, QoSProfiles.QOS_E, client_ip=ip, client_port=port)
534+
qod_client.set_quality(300, QoSProfiles.QOS_E, client_ip=ip, client_port=port)
531535
```
532536
```node Sample SDK for Node.js
533537
const ip = req.ip

catalog/simswap/samplecode_simswap.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ First step is to instantiate the SIM Swap service class included in the correspo
4141
Since Open Gateway authorization is 3-legged, meaning it identifies the application, the operator and the operator's subscriber, who is also the end-user holder of the mobile line, each check for a different phone number needs its own SDK class instantiation, or access token if not using an SDK.
4242

4343
```python Sandbox SDK for Python
44-
from opengateway_sandbox_sdk import ClientCredentials, Simswap
44+
from opengateway_sandbox_sdk import Simswap
4545

4646
client_id = 'your_client_id'
4747
client_secret = 'your_client_secret'
@@ -225,6 +225,8 @@ JSONObject jsonResponse = new JSONObject(response.body());
225225
String accessToken = jsonResponse.getString("access_token");
226226
```
227227
```python Sample HTTP using Python
228+
import base64
229+
import requests
228230
# First step:
229231
# Perform an authorization request
230232

@@ -352,7 +354,7 @@ headers = {
352354
}
353355

354356
data = {
355-
"phoneNumber": customer_phone_number, # as set in the authorization step
357+
"phoneNumber": customer_phone_number, # as set in the authorization step
356358
}
357359

358360
response = requests.post(
@@ -453,7 +455,7 @@ fetch(url, requestOptions);
453455
Samples represent how to publish the callback URL in Python or Node.js, so the code from the Auth Code Flow can be received. The same can be achieved in any other language with capabilities to run an HTTP server and listen for the redirect from the authorization flow:
454456

455457
```python Sandbox SDK for Python
456-
from flask import Flask, request, jsonify
458+
from flask import Flask, request
457459
from opengateway_sandbox_sdk import ClientCredentials, Simswap
458460

459461
credentials = ClientCredentials(
@@ -463,6 +465,7 @@ credentials = ClientCredentials(
463465

464466
app = Flask(__name__)
465467

468+
466469
@app.route('/simswap-callback', methods=['GET'])
467470
def callback():
468471
code = request.args.get('code', '')
@@ -473,7 +476,7 @@ if __name__ == '__main__':
473476
app.run()
474477
```
475478
```python Sample SDK for Python
476-
from flask import Flask, request, jsonify
479+
from flask import Flask, request
477480
from aggregator_opengateway_sdk import ClientCredentials, SimSwap
478481

479482
credentials = ClientCredentials(
@@ -483,6 +486,7 @@ credentials = ClientCredentials(
483486

484487
app = Flask(__name__)
485488

489+
486490
@app.route('/simswap-callback', methods=['GET'])
487491
def callback():
488492
code = request.args.get('code', '')
@@ -538,7 +542,9 @@ app.listen(port, () => {
538542
})
539543
```
540544
```python Sample HTTP using Python
541-
from flask import Flask, request, jsonify
545+
import base64
546+
import requests
547+
from flask import Flask, request
542548

543549
client_id = "my-app-id"
544550
client_secret = "my-app-secret"
@@ -548,6 +554,7 @@ api_scope = "dpv:FraudPreventionAndDetection#sim-swap"
548554

549555
app = Flask(__name__)
550556

557+
551558
@app.route('/simswap-callback', methods=['GET'])
552559
def callback():
553560
code = request.args.get('code', '')

0 commit comments

Comments
 (0)