-
Notifications
You must be signed in to change notification settings - Fork 0
/
fb_wabp_billing.py
130 lines (109 loc) · 3.29 KB
/
fb_wabp_billing.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# You can download the individual rate cards and find the country to region mapping for countries where regional rates apply.
# Given the Facebook cost per conversion in USD sheet, get a dictionary with key: value pairs.
# Market : Business-Initiated Rate, User-Initiated Rate
# https://developers.facebook.com/docs/whatsapp/pricing
# I like this Stanford tuts on python dictionary
# http://www.compciv.org/guides/python/fundamentals/dictionaries-overview/
# Instagram Basic display API: https://developers.facebook.com/docs/instagram-basic-display-api
#
'''
cost = "market" : {
"Argentina" : [0.0526, 0.0316],
"Brazil" : [0.0500, 0.0300],
"Chile" : [0.0757, 0.0454],
"Nigeria" : [0.0516, 0.0310]
}
for key, value in enumertae():
print(key, value)
datathing = {
"status": "good",
"last_updated": "2012-12-07T18:11:55Z"
}
if datathing['status'] == 'good':
print("Things are good")
else:
print("WTF!?!??!")
****
datathing = [{
"status": "good",
"body": "Everything operating normally.",
"created_on": "2016-01-21T20:28:31Z"
}, {
"status": "minor",
"body": "We're investigating issues serving GitHub pages.",
"created_on": "2016-01-21T20:25:03Z"
}, {
"status": "good",
"body": "Everything operating normally.",
"created_on": "2016-01-20T22:56:57Z"
}, {
"status": "minor",
"body": "We're investigating issues affecting a small number of repositories.",
"created_on": "2016-01-20T22:47:07Z"
}]
for d in datathing: # remember that datathing is a list
print(d['created_on'], '--',
d['status'] + ':')
print(d['body'])
print("")
****
#snoop dogg on instagram
datathing = {
"data": {
"id": "1574083",
"username": "snoopdogg",
"full_name": "Snoop Dogg",
"profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1574083_75sq_1295469061.jpg",
"bio": "This is my bio",
"website": "http://snoopdogg.com",
"counts": {
"media": 1320,
"follows": 420,
"followed_by": 3410
}
}
}
user = datathing["data"]
print(user['username'])
print("Bio:", user["bio"])
counts = user['counts']
print("You follow this number of people:", counts['follows'])
*****
'''
# beyonce on spotify
beyonce = {
"name" : "Beyonce",
"popularity" : 86,
"type" : "artist",
"uri" : "spotify:artist:6vWDO969PvNqNYHIOW5v0m",
"external_urls" : {
"spotify" : "https://open.spotify.com/artist/6vWDO969PvNqNYHIOW5v0m"
},
"followers" : {
"href" : None,
"total" : 3841151
},
"genres" : [ "dance pop", "pop", "r&b", "urban contemporary" ],
"href" : "https://api.spotify.com/v1/artists/6vWDO969PvNqNYHIOW5v0m",
"id" : "6vWDO969PvNqNYHIOW5v0m",
"images" : [ {
"height" : 1000,
"url" : "https://i.scdn.co/image/a370c003642050eeaec0bc604409aa585ca92297",
"width" : 1000
}, {
"height" : 640,
"url" : "https://i.scdn.co/image/79e91d3cd4a7c15e0c219f4e6c941d282fe87a3d",
"width" : 640
} ]
}
# get her actual name
print(beyonce['name'])
# get her number of followers
print(beyonce['followers']['total'])
# get the genres
print(beyonce["genres"])
# get the images she has, with their attributes
for img in beyonce['images']:
print('-----')
for key, val in img.items():
print(key + ':', val)