-
Notifications
You must be signed in to change notification settings - Fork 9
/
test.py
51 lines (49 loc) · 1.49 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# import mpesawrapper
# mpesa=mpesawrapper.Generatetoken()
# token=mpesa.generate_token(consumer_key="GC2WUo0oFPkUt4ARPbA37mtwGHN3vGAE",consumer_secret="LVrZL1rvCMkAgjXG")
# print (token)
# import uplink,json
#
#
# # To define common request metadata, you can decorate the class
# # rather than each method separately.
# @uplink.headers({"Accept": "application/vnd.github.v3.full+json"})
# class GitHub(uplink.Consumer):
#
# @uplink.json
# @uplink.post("/help")
# def update_user(self, **info:uplink.Body):
# print (type(uplink.Body))
#
#
# github = GitHub(base_url="http://localhost:8888")
# response = github.update_user(bio="Beam me up, Scotty!",text="make out")
# print(response.json())
#
# import requests,json
# from requests.auth import HTTPBasicAuth
#
# consumer_key = "GC2WUo0oFPkUt4ARPbA37mtwGHN3vGAE"
# consumer_secret = "LVrZL1rvCMkAgjXG"
# api_URL = "https://sandbox.safaricom.co.ke/oauth/v1/generate?grant_type=client_credentials"
#
# r = requests.get(api_URL, auth=HTTPBasicAuth(consumer_key, consumer_secret))
# access_token=json.loads(r.text)
# access_token =access_token.get("access_token")
# print (access_token)
#
#
#
#
#
# api_url = "https://sandbox.safaricom.co.ke/mpesa/stkpushquery/v1/query"
# headers = {"Authorization": "Bearer %s" % access_token}
# request = { "BusinessShortCode": " " ,
# "Password": " ",
# "Timestamp": " ",
# "CheckoutRequestID": " "
# }
#
# response = requests.post(api_url, json = request, headers=headers)
#
# print (response.text)