In [1]:
#Getting Info on All Representatives in Amyotha

import requests #for REST requests to API
import pandas #for working with data

In [51]:
#Get JSON of all posts and memberships in Amyotha:
amyotha_req = requests.get('http://api.openhluttaw.org/en/organizations/897739b2831e41109713ac9d8a96c845')

#Get details of all members of parliament
MPs = amyotha_req.json()['result']['memberships']

    
#List all MP Posts
constituencies = amyotha_req.json()['result']['posts']

for i in constituencies:
    print i['label']


Ayeyawaddy-1
Ayeyawaddy-12
Ayeyawaddy-4
Ayeyawaddy-7
Bago-1
Bago-12
Bago-4
Bago-7
Chin-1
Chin-12
Chin-4
Chin-7
Kachin-1
Kachin-12
Kachin-4
Kachin-7
Kayah-1
Kayah-12
Kayah-4
Kayah-7
Kayin-1
Kayin-12
Kayin-4
Kayin-7
Magway-1
Magway-12
Magway-4
Magway-7
Mandalay-1
Mandalay-12
Mandalay-4
Mandalay-7
Mon-1
Mon-12
Mon-4
Mon-7
Rakhine-1
Rakhine-12
Rakhine-4
Rakhine-7
Sagaing-1
Sagaing-12
Sagaing-4
Sagaing-7
Shan-1
Shan-12
Shan-4
Shan-7
Taninthayi-1
Taninthayi-12
Taninthayi-4
Taninthayi-7
Yangon-1
Yangon-12
Yangon-4
Yangon-7
Ayeyawaddy-10
Ayeyawaddy-2
Ayeyawaddy-5
Ayeyawaddy-8
Bago-10
Bago-2
Bago-5
Bago-8
Chin-10
Chin-2
Chin-5
Chin-8
Kachin-10
Kachin-2
Kachin-5
Kachin-8
Kayah-10
Kayah-2
Kayah-5
Kayah-8
Kayin-10
Kayin-2
Kayin-5
Kayin-8
Magway-10
Magway-2
Magway-5
Magway-8
Mandalay-10
Mandalay-2
Mandalay-5
Mandalay-8
Mon-10
Mon-2
Mon-5
Mon-8
Rakhine-10
Rakhine-2
Rakhine-5
Rakhine-8
Sagaing-10
Sagaing-2
Sagaing-5
Sagaing-8
Shan-10
Shan-2
Shan-5
Shan-8
Taninthayi-10
Taninthayi-2
Taninthayi-5
Taninthayi-8
Yangon-10
Yangon-2
Yangon-5
Yangon-8
Chin-6
Chin-9
Kachin-11
Kachin-3
Kachin-6
Kachin-9
Kayah-11
Kayah-3
Kayah-6
Kayah-9
Kayin-11
Kayin-3
Kayin-6
Kayin-9
Magway-11
Magway-3
Magway-6
Magway-9
Mandalay-11
Mandalay-3
Mandalay-6
Mandalay-9
Mon-11
Mon-3
Mon-6
Mon-9
Rakhine-11
Rakhine-3
Rakhine-6
Rakhine-9
Sagaing-11
Sagaing-3
Sagaing-6
Sagaing-9
Shan-11
Shan-3
Shan-6
Shan-9
Ayeyawaddy-11
Ayeyawaddy-3
Ayeyawaddy-6
Ayeyawaddy-9
Bago-11
Bago-3
Bago-6
Bago-9
Chin-11
Chin-3
Taninthayi-11
Taninthayi-3
Taninthayi-6
Taninthayi-9
Yangon-11
Yangon-3
Yangon-6
Yangon-9

In [52]:
#MPs memberships also hold details of person and post of MP of a constituent
for mp in MPs:
    print mp['person']['name'] +" MP for " + mp['post']['label']


Thein Swe MP for Ayeyawaddy-10
Thein Swe MP for Ayeyawaddy-10
May Than New MP for Ayeyawaddy-11
Kyi Win MP for Ayeyawaddy-12
Khin Zaw Linn MP for Ayeyawaddy-2
San Myint MP for Ayeyawaddy-3
Htein Win MP for Ayeyawaddy-4
Maung Maung Ohn MP for Ayeyawaddy-5
Tun Kyaing MP for Ayeyawaddy-6
Pyae Phyo MP for Ayeyawaddy-7
Ei Ei Pyone MP for Ayeyawaddy-8
Toe Shwe MP for Ayeyawaddy-9
San Maung Maung MP for Bago-1
Win Kyaing MP for Bago-10
Win Myint MP for Bago-11
Aung Thein MP for Bago-12
Moe Myint Aung MP for Bago-2
Shwe Shwe Sein Latt MP for Bago-3
Win Myat Aye MP for Bago-4
Tin Tin Win MP for Bago-5
Min Oo MP for Bago-6
Mya Thaung MP for Bago-7
Win Myint Chit MP for Bago-8
Aye Cho MP for Bago-9
Ngun Hay MP for Chin-1
Lahl Minn Htan MP for Chin-10
Whave Tinn MP for Chin-11
Myo Htike MP for Chin-12
Shun Awr MP for Chin-2
Henery Van Thio MP for Chin-3
Zone Hlal Htan MP for Chin-4
Mam Law Mung MP for Chin-8
Khin Swe Lwin MP for Chin-9
J Yaw Wu (a)  R Wu Sha MP for Kachin-1
Thein Lwin MP for Kachin-10
Win Thaung MP for Kachin-11
Naing Ko Ko MP for Kachin-12
Shilar Nan Taung (or)  Am Nan Taung MP for Kachin-2
Zel Gaung MP for Kachin-3
Naung Na Jhatan MP for Kachin-4
Za Khone Taint Yein MP for Kachin-5
Min Swe Naing MP for Kachin-6
U Win Zaw MP for Kachin-7
Khin Ma Gyi MP for Kachin-8
U Khin Maung Myint MP for Kachin-9
U Phye Ral (or) U Myint Than Htoo MP for Kayah-1
Naw Mya Say MP for Kayah-11
Pan Pha MP for Kayah-12
Shae Ral Sh Mang MP for Kayah-2
Bawral Soe Wai MP for Kayah-3
Saw Sein Htn MP for Kayah-4
Sharr M MP for Kayah-5
Lwee Zar MP for Kayah-6
Ang Kyaw Soe MP for Kayah-7
name MP for Kayah-9
Saw Moe Myint (or) Simal MP for Kayin-1
Myo Ang MP for Kayin-10
Sa Hm Htoo MP for Kayin-11
Saw Shar Pon Wah MP for Kayin-12
Saw Than Htt MP for Kayin-2
Saw Chit Oo MP for Kayin-3
Nan Moe Moe Htwe MP for Kayin-4
Naw Christn (or) Arr Kar Mo MP for Kayin-7
Man Win Khaing Than MP for Kayin-8
Saw Be San Thein Myint MP for Kayin-9
Hla San MP for Magway-1
Kyaw Ngwe MP for Magway-10
Kyaw Swe MP for Magway-11
Pye Lwin MP for Magway-12
Khin Win MP for Magway-2
Chit Htwe MP for Magway-3
Ang Kyi Nynt MP for Magway-4
Tin Ang Htn MP for Magway-5
Win Mang MP for Magway-6
Than Than Aye MP for Magway-7
Win Myint MP for Magway-8
Mya Min Swe MP for Magway-9
Than Win MP for Mandalay-1
Kyaw Myint Oo MP for Mandalay-10
Kyaw Thiha MP for Mandalay-12
Htn Htn Oo MP for Mandalay-2
Kyaw Than Htn (Kanton) MP for Mandalay-3
Hla Htay (or)  Ohn Kyi MP for Mandalay-4
Ang Myo Latt MP for Mandalay-5
Kywe Kywe MP for Mandalay-6
Kyaw Toke MP for Mandalay-7
Mang Mang Swe MP for Mandalay-9
Aye Min Han MP for Mon-1
Thiha (or) Mang Too MP for Mon-10
Hla Myint (or) Hla Myint Than MP for Mon-11
Thiri Yadanar MP for Mon-12
New New Ang MP for Mon-2
Khin Zaw Oo MP for Mon-3
Linn Tin Htay MP for Mon-4
Myat Thitar Tun MP for Mon-5
Pe Tin MP for Mon-6
Naing Thiha MP for Mon-7
Myo Win MP for Mon-8
Zaw Linn Htut MP for Mon-9
Soe Win MP for Rakhine-12
Kyaw Thaung MP for Sagaing-1
Tin Maung Win MP for Sagaing-10
Min Naing MP for Sagaing-12
Aung Myo MP for Sagaing-2
Win Aung MP for Sagaing-3
Hla Oo MP for Sagaing-4
Ye Htut MP for Sagaing-5
Zaw Min MP for Sagaing-6
Khin Maung Win MP for Sagaing-7
Ko Ko Naing MP for Sagaing-8
Maung Maung Latt MP for Sagaing-9
Zaw Min Latt (or) Ko Latt MP for Shan-1
Lon Hsan Khat MP for Shan-7
Ma Ma Lay MP for Shan-8
Thein Pe MP for Shan-9
Aung Win MP for Taninthayi-1
Soe Thein (or) U Maung Soe MP for Taninthayi-10
Khin Maung Win MP for Taninthayi-11
Khin Myo Win MP for Taninthayi-12
Thet Naing Soe MP for Taninthayi-2
Tun Linn MP for Taninthayi-3
Han Win Thein MP for Taninthayi-4
Linn Wai Phyo Latt MP for Taninthayi-5
Tin Wai MP for Taninthayi-6
Zaw Hein MP for Taninthayi-7
Okka Min MP for Taninthayi-8
Kin Shein MP for Taninthayi-9
Htay Kywe MP for Yangon-1
Hla Hla Soe MP for Yangon-10
Aye Bo MP for Yangon-11
Kyaw Naing MP for Yangon-12
Htay Oo MP for Yangon-2
Myat Nyarna Soe MP for Yangon-3
Than Soe (or) Than Soe (Eco) MP for Yangon-4
Ba Myo Thein MP for Yangon-5
Aung Thu MP for Yangon-6
Ye Myint Soe MP for Yangon-7
Kyaw Htwe MP for Yangon-8
Pe Chit MP for Yangon-9
Thar Sein MP for Kayah-10
Hsai Kyauk Sam MP for Shan-6
Nyi Pu MP for Shan-5
Ohn Kyaw MP for Shan-4
Wan Hlaing Kham MP for Shan-3
Tun Aung MP for Shan-2
San Aung MP for Shan-12
Ohm Khaing MP for Shan-10
Maung Kyaw Zan MP for Rakhine-9
Kyaw Kyaw Win MP for Rakhine-8
Kyaw Thein MP for Rakhine-7
Aye Thar Aung MP for Rakhine-6
Kyaw Kyaw MP for Rakhine-4
Khin Maung Latt MP for Rakhine-3
Tett Tun Aung MP for Rakhine-2
Htoot May MP for Rakhine-11
Kyaw Than MP for Rakhine-10
Wai Sein Aung MP for Rakhine-1
Soe Ang MP for Mandalay-11
Nan Ni Ni Aye MP for Kayin-6
Kyaw Than MP for Kayah-8
Nyi Nyi Htwe (or)  Ko Ko Lay MP for Sagaing-11
Than Naing MP for Kayin-5
Kyain Ngeik Man MP for Chin-7
Pu Ghin Kan Lian MP for Chin-5
Soe Moe MP for Ayeyawaddy-1
Kyain Khant Pung MP for Chin-6
Kyaw Ni Naing MP for Shan-11
Myint Naing MP for Rakhine-5
Khin Ang Myint MP for Mandalay-8

In [53]:
#Persons and Posts also have other details such as birth_dates, gender etc.
#see popolo spec 
for mp in MPs:
    print mp['person']['name'] + " , " + mp['person']['gender'] + " , " +  mp['person']['birth_date']


Thein Swe , male , 1967-09-29
Thein Swe , male , 1967-09-29
May Than New , female , 1964-08-28
Kyi Win , male , 1946-05-27
Khin Zaw Linn , Male , 1973-01-10
San Myint , male , 1950-02-02
Htein Win , male , 1959-03-10
Maung Maung Ohn , male , 1950-05-19
Tun Kyaing , Male , 1951-10-17
Pyae Phyo , male , 1955-06-13
Ei Ei Pyone , female , 1981-09-27
Toe Shwe , male , 1947-02-25
San Maung Maung , male , 1958-05-24
Win Kyaing , male , 1955-05-16
Win Myint , male , 1955-09-21
Aung Thein , male , 1946-11-17
Moe Myint Aung , male , 1969-03-04
Shwe Shwe Sein Latt , female , 1966-06-29
Win Myat Aye , male , 1954-01-06
Tin Tin Win , female , 1947-10-25
Min Oo , male , 1982-08-19
Mya Thaung , male , 1955-01-14
Win Myint Chit , male , 1962-04-04
Aye Cho , male , 1957-05-07
Ngun Hay , male , 1973-01-10
Lahl Minn Htan , male , 1979-04-20
Whave Tinn , male , 1979-10-03
Myo Htike , male , 1982-08-02
Shun Awr , male , 1948-12-08
Henery Van Thio , male , 1958-09-08
Zone Hlal Htan , male , 1973-11-13
Mam Law Mung , male , 1954-06-19
Khin Swe Lwin , female , 1969-10-14
J Yaw Wu (a)  R Wu Sha , male , 1969-04-14
Thein Lwin , male , 1957-08-02
Win Thaung , male , 1956-10-17
Naing Ko Ko , male , 1980-05-07
Shilar Nan Taung (or)  Am Nan Taung , female , 1954-06-10
Zel Gaung , male , 1981-07-09
Naung Na Jhatan , male , 1956-05-03
Za Khone Taint Yein , male , 1940-04-22
Min Swe Naing , male , 1970-01-29
U Win Zaw , male , 1982-12-05
Khin Ma Gyi , female , 1952-04-25
U Khin Maung Myint , male , 1951-12-28
U Phye Ral (or) U Myint Than Htoo , male , 1976-09-01
Naw Mya Say , female , 1946-03-15
Pan Pha , male , 1977-12-07
Shae Ral Sh Mang , male , 1952-08-27
Bawral Soe Wai , male , 1963-11-05
Saw Sein Htn , male , 1962-09-12
Sharr M , female , 1960-03-28
Lwee Zar , female , 1978-02-12
Ang Kyaw Soe , male , 1968-09-18
name , gender , 1948-07-09
Saw Moe Myint (or) Simal , male , 1947-02-01
Myo Ang , male , 1952-02-17
Sa Hm Htoo , female , 1953-11-11
Saw Shar Pon Wah , male , 1983-12-10
Saw Than Htt , male , 1958-03-21
Saw Chit Oo , male , 1975-03-08
Nan Moe Moe Htwe , female , 1983-11-06
Naw Christn (or) Arr Kar Mo , female , 1963-08-12
Man Win Khaing Than , male , 1952-04-23
Saw Be San Thein Myint , male , 1963-06-30
Hla San , male , 1957-11-16
Kyaw Ngwe , male , 1956-06-06
Kyaw Swe , male , 1962-11-21
Pye Lwin , male , 1963-04-25
Khin Win , male , 1952-10-01
Chit Htwe , male , 1965-07-13
Ang Kyi Nynt , male , 1950-08-09
Tin Ang Htn , male , 1965-04-17
Win Mang , male , 1950-06-29
Than Than Aye , female , 1961-09-08
Win Myint , male , 1949-10-26
Mya Min Swe , male , 1978-06-05
Than Win , male , 1953-02-04
Kyaw Myint Oo , male , 1974-12-03
Kyaw Thiha , male , 1959-03-23
Htn Htn Oo , male , 1961-04-22
Kyaw Than Htn (Kanton) , male , 1945-07-07
Hla Htay (or)  Ohn Kyi , female , 1952-02-25
Ang Myo Latt , male , 1973-02-12
Kywe Kywe , male , 1960-10-30
Kyaw Toke , male , 1963-10-06
Mang Mang Swe , male , 1971-05-23
Aye Min Han , male , 1983-05-22
Thiha (or) Mang Too , male , 1974-01-01
Hla Myint (or) Hla Myint Than , male , 1945-12-26
Thiri Yadanar , female , 1979-09-21
New New Ang , female , 1956-09-29
Khin Zaw Oo , male , 1966-06-27
Linn Tin Htay , male , 1985-07-13
Myat Thitar Tun , female , 1981-07-10
Pe Tin , male , 1947-09-16
Naing Thiha , male , 1966-09-23
Myo Win , male , 1959-04-29
Zaw Linn Htut , male , 1964-11-02
Soe Win , male , 1957-10-22
Kyaw Thaung , male , 1949-09-05
Tin Maung Win , male , 1956-02-15
Min Naing , male , 1963-05-12
Aung Myo , male , 1963-03-02
Win Aung , male , 1954-01-14
Hla Oo , male , 1957-10-14
Ye Htut , male , 1942-03-20
Zaw Min , male , 1949-07-17
Khin Maung Win , male , 1954-12-10
Ko Ko Naing , male , 1962-01-11
Maung Maung Latt , male , 1966-11-24
Zaw Min Latt (or) Ko Latt , male , 1974-12-04
Lon Hsan Khat , male , 1965-03-15
Ma Ma Lay , female , 1962-07-12
Thein Pe , male , 1966-10-28
Aung Win , male , 1952-06-27
Soe Thein (or) U Maung Soe , male , 1966-06-09
Khin Maung Win , male , 1955-05-23
Khin Myo Win , male , 1968-06-12
Thet Naing Soe , male , 1974-05-04
Tun Linn , male , 1948-06-08
Han Win Thein , male , 1964-04-12
Linn Wai Phyo Latt , male , 1980-01-06
Tin Wai , male , 1963-11-02
Zaw Hein , male , 1984-08-21
Okka Min , male , 1984-04-11
Kin Shein , male , 1940-10-02
Htay Kywe , male , 1951-07-07
Hla Hla Soe , female , 1965-08-18
Aye Bo , male , 1969-01-24
Kyaw Naing , male , 1951-09-24
Htay Oo , male , 1956-07-21
Myat Nyarna Soe , male , 1974-10-22
Than Soe (or) Than Soe (Eco) , male , 1973-07-02
Ba Myo Thein , male , 1954-05-08
Aung Thu , male , 1955-08-07
Ye Myint Soe , male , 1948-08-12
Kyaw Htwe , male , 1968-05-27
Pe Chit , male , 1948-04-11
Thar Sein , male , 1960-06-16
Hsai Kyauk Sam , male , 1951-10-22
Nyi Pu , male , 1957-12-11
Ohn Kyaw , male , 1944-04-06
Wan Hlaing Kham , male , 1981-05-08
Tun Aung , male , 1963-10-13
San Aung , male , 1959-03-25
Ohm Khaing , male , 1964-01-14
Maung Kyaw Zan , male , 1964-12-17
Kyaw Kyaw Win , male , 1978-10-12
Kyaw Thein , male , 1954-11-03
Aye Thar Aung , male , 1945-10-12
Kyaw Kyaw , male , 1950-08-07
Khin Maung Latt , male , 1953-11-17
Tett Tun Aung , male , 1959-06-16
Htoot May , female , 1979-06-16
Kyaw Than , male , 1956-07-12
Wai Sein Aung , male , 1946-03-28
Soe Ang , male , 1950-08-05
Nan Ni Ni Aye , female , 1969-12-10
Kyaw Than , male , 1965-05-31
Nyi Nyi Htwe (or)  Ko Ko Lay , male , 1970-05-25
Than Naing , male , 1961-09-22
Kyain Ngeik Man , female , 1974-05-01
Pu Ghin Kan Lian , male , 1954-06-30
Soe Moe , male , 1979-07-31
Kyain Khant Pung , male , 1955-07-19
Kyaw Ni Naing , male , 1974-10-18
Myint Naing , male , 1968-07-25
Khin Ang Myint , male , 1946-06-10

In [54]:
#To get contact details, we need to make additional requests for the person based on their id
for mp in MPs:
    person = requests.get('http://api.openhluttaw.org/en/persons/' + mp['person']['id']).json()['result']
    if person['contact_details']: #not everyone may contact details
        for contact in person['contact_details']: #can be multiple contact types
            if contact['type'] == 'email':
                print contact['value']


swe.minsoe@gmail.com
swe.minsoe@gmail.com
khinzawlinn@gmail.com
mgmgohn112015@gmail.com
hobbitt1347@gmail.com
eipyone13@gmail.com
dr.winmyint@gmail.com
mishwelatt@gmail.com
wmaye10@gmail.com
minoosan.5871@gmail.com
drmyathaung2017@gmail.com
gaiktin@gmail.com
salaisiangawrvanhnin@gmail.com
henryvthio@gmail.com
cmfamily.forever@gmail.com
ngweyisan@gmail.com
ukhinwinyng@gmail.com
chithtwaymaung@gmail.com
aungknyunt.akn@gmail.com
utinaunghtun@gmail.com
than53win69@gmail.com
kyawthihad@gmail.com
rspmdmyotun@gmail.com
aungmyolatt@gmail.com
drukywekywe@gmail.com
ayeminhan@gmail.com
thiri79.th@gmail.com
daw.nwe2aung@gmail.com
flydragon55@gmail.com
khinmyanmarnwe@gmail.com
sayamyowin.ye@gmail.com
thornbirds.1962@gmail.com
maunglat626@gmail.com
uwinn9@gmail.com
sthein@gmail.com
tnsnldll.nld@gmail.com
han.wt@gmail.com
drlynnwaiphyo35@gmail.com
tinwai612@gmail.com
zawheinnld@gmail.com
nldmyeik2015@gmail.com
susanna7@gmail.com
sss.kyawnaing@gmail.com
nyarna.soe.politician@gmail.com
thansoe.economist@gmail.com
zeyayso@gmail.com
myamyintmoe2000@gmail.com
kyaw.htway06@gmail.com
pechit1948@gmail.com
tawthar285@gmail.com

In [66]:
#Example of CSV contact list of Women MPs

women = [ mp for mp in MPs if mp['person']['gender'] == 'female' ]

woman_mps = []

for mp in women:
    
    person = requests.get('http://api.openhluttaw.org/en/persons/' + mp['person']['id']).json()['result']
    
    woman_mp = {} 
    woman_mp ['name'] = mp['person']['name']    
    woman_mp ['constituency'] = mp['post']['label']
    
    if person['contact_details']: #not everyone may contact details
        for contact in person['contact_details']: #can be multiple contact types
            if contact['type'] == 'cell':
                woman_mp['phone'] = contact['value']
            elif contact['type'] == 'email':
                woman_mp['email'] = contact['value']
    woman_mps.append(woman_mp)

In [64]:
women_df = pandas.DataFrame(woman_mps,columns=['name','constituency','phone','email'])

women_df


Out[64]:
name constituency phone email
0 May Than New Ayeyawaddy-11 09 2542 00083 NaN
1 Ei Ei Pyone Ayeyawaddy-8 09 9730 14295 eipyone13@gmail.com
2 Shwe Shwe Sein Latt Bago-3 09 7948 05020 mishwelatt@gmail.com
3 Tin Tin Win Bago-5 09 5120 842 NaN
4 Khin Swe Lwin Chin-9 09 4932 4311 NaN
5 Shilar Nan Taung (or) Am Nan Taung Kachin-2 09 4302 2445 NaN
6 Khin Ma Gyi Kachin-8 09 7932 16177 NaN
7 Naw Mya Say Kayah-11 09 2543 07845 NaN
8 Sharr M Kayah-5 083 45004 NaN
9 Lwee Zar Kayah-6 09 2501 76980 NaN
10 Sa Hm Htoo Kayin-11 09 4977 1474 NaN
11 Nan Moe Moe Htwe Kayin-4 09 8731 180 NaN
12 Naw Christn (or) Arr Kar Mo Kayin-7 09 4281 44244 cmfamily.forever@gmail.com
13 Than Than Aye Magway-7 09 4933 1724 NaN
14 Hla Htay (or) Ohn Kyi Mandalay-4 09 3302 6750 NaN
15 Thiri Yadanar Mon-12 09 4253 50140 thiri79.th@gmail.com
16 New New Ang Mon-2 09 5322 235 daw.nwe2aung@gmail.com
17 Myat Thitar Tun Mon-5 09 4252 61395 khinmyanmarnwe@gmail.com
18 Ma Ma Lay Shan-8 09 4283 36055 NaN
19 Hla Hla Soe Yangon-10 09 2507 95258 susanna7@gmail.com
20 Htoot May Rakhine-11 NaN NaN
21 Nan Ni Ni Aye Kayin-6 NaN NaN
22 Kyain Ngeik Man Chin-7 NaN NaN

In [65]:
women_df.to_csv() # eg. to save to file: print >>open('women_mp_contacts','a') , women_df.to_csv()


Out[65]:
',name,constituency,phone,email\n0,May Than New,Ayeyawaddy-11,09 2542 00083,\n1,Ei Ei Pyone,Ayeyawaddy-8,09 9730 14295,eipyone13@gmail.com\n2,Shwe Shwe Sein Latt,Bago-3,09 7948 05020,mishwelatt@gmail.com\n3,Tin Tin Win,Bago-5,09 5120 842,\n4,Khin Swe Lwin,Chin-9,09 4932 4311,\n5,Shilar Nan Taung (or)  Am Nan Taung,Kachin-2,09 4302 2445,\n6,Khin Ma Gyi,Kachin-8,09 7932 16177,\n7,Naw Mya Say,Kayah-11,09 2543 07845,\n8,Sharr M,Kayah-5,083 45004,\n9,Lwee Zar,Kayah-6,09 2501 76980,\n10,Sa Hm Htoo,Kayin-11,09 4977 1474,\n11,Nan Moe Moe Htwe,Kayin-4,09 8731 180,\n12,Naw Christn (or) Arr Kar Mo,Kayin-7,09 4281 44244,cmfamily.forever@gmail.com\n13,Than Than Aye,Magway-7,09 4933 1724,\n14,Hla Htay (or)  Ohn Kyi,Mandalay-4,09 3302 6750,\n15,Thiri Yadanar,Mon-12,09 4253 50140,thiri79.th@gmail.com\n16,New New Ang,Mon-2,09 5322 235,daw.nwe2aung@gmail.com\n17,Myat Thitar Tun,Mon-5,09 4252 61395,khinmyanmarnwe@gmail.com\n18,Ma Ma Lay,Shan-8,09 4283 36055,\n19,Hla Hla Soe,Yangon-10,09 2507 95258,susanna7@gmail.com\n20,Htoot May,Rakhine-11,,\n21,Nan Ni Ni Aye,Kayin-6,,\n22,Kyain Ngeik Man,Chin-7,,\n'

Committees


In [13]:
#List all committees

query = 'classification:Committee'
r = requests.get('http://api.openhluttaw.org/en/search/organizations?q='+query)
pages = r.json()['num_pages']


committees = []
for page in range(1,pages+1):
    r = requests.get('http://api.openhluttaw.org/en/search/organizations?q='+query+'&page='+str(page))
    orgs = r.json()['results']
    for org in orgs:
        committees.append(org)

In [14]:
for committee in committees:
    print committee['name']


Pyithu Hluttaw Ethinic Affairs and Internal Peace Committee
Pyithu Hluttaw Economic and Financial Development Committee
Pyithu Hluttaw Agriculture, Livestock Breeding and Fishery Development Committee
Pyithu Hluttaw Mineral, Natural Resources and Environmental Conservation Committee
Pyithu Hluttaw Citizens' Fundamental Rights Committee
Amyotha Hluttaw Bill Committee
Amyotha Hluttaw Mineral, Natural Resources and Environmental Conservation Committee
Pyithu Hluttaw Health and Sports Promotion Committee
Pyithu Hluttaw Public Management Committee
Pyithu Hluttaw Public Accounts Committee
Pyihtaungsu Hluttaw Joint Public Accounts Committee
Amyotha Hluttaw Local and International Non-Government Organizations Committee
Amyotha Hluttaw Hluttaw Rights Committee
Pyithu Hluttaw Transportation, Communications and Construction Committee
Pyithu Hluttaw Hluttaw Rights Committee
Pyidaungsu Hluttaw Joint Bill Committee
Amyotha Hluttaw Women and Children's Rights Committee
Amyotha Hluttaw Farmer Affairs Committee
Amyotha Hluttaw Public Complaints Committee
Amyotha Hluttaw Health, Sports and Culture Committee
Amyotha Hluttaw Ethnic Affairs Committee
Pyidaungsu Hluttaw Joint Committee on ASEAN Inter-Parliamentary Union
Pyithu Hluttaw Bill Committee
Amyotha Hluttaw Public Accounts Committee
Pyithu Hluttaw International Relations Committee
Amyotha Hluttaw Government’s Guarantees, Pledges and Undertakings Vetting Committee
Amyotha Hluttaw International Relations, Inter-parlimentary Relations and Cooperation Committee
Pyithu Hluttaw Banks and Monetary Affairs Development Committee
Amyotha Hluttaw Education Promotion Committee
Amyotha Hluttaw Local and Overseas Employment Committee

In [25]:
import json

json_export = []
for committee in committees:
    json_export.append({'name':committee['name'],
                        'id':committee['id']})

print json.dumps(json_export,sort_keys=True, indent=4)


[
    {
        "id": "cedb960df60c486d99d731a6356ef6f0", 
        "name": "Pyithu Hluttaw Ethinic Affairs and Internal Peace Committee"
    }, 
    {
        "id": "47b0a9c407294e26959607bbbffc6c9b", 
        "name": "Pyithu Hluttaw Economic and Financial Development Committee"
    }, 
    {
        "id": "95d5c1821bec44c9a6567e0fc27b4f76", 
        "name": "Pyithu Hluttaw Agriculture, Livestock Breeding and Fishery Development Committee"
    }, 
    {
        "id": "f05e8d42913b4b8cb825be9c82b0cf2f", 
        "name": "Pyithu Hluttaw Mineral, Natural Resources and Environmental Conservation Committee"
    }, 
    {
        "id": "c71e6b0464614643b678aae2bd82e170", 
        "name": "Pyithu Hluttaw Citizens' Fundamental Rights Committee"
    }, 
    {
        "id": "880a9eeb586c4d058248ad2e43e8405d", 
        "name": "Amyotha Hluttaw Bill Committee"
    }, 
    {
        "id": "c1cf276bdb8f4f308b9eb709cb78a6a2", 
        "name": "Amyotha Hluttaw Mineral, Natural Resources and Environmental Conservation Committee"
    }, 
    {
        "id": "bb595e43f7494966a7db1a76dfef6207", 
        "name": "Pyithu Hluttaw Health and Sports Promotion Committee"
    }, 
    {
        "id": "c34d5ed06e194f508a13886246a88f82", 
        "name": "Pyithu Hluttaw Public Management Committee"
    }, 
    {
        "id": "c801a90c96c2482fbff5f319bacbe544", 
        "name": "Pyithu Hluttaw Public Accounts Committee"
    }, 
    {
        "id": "d2c89a065e9e4f0ebbfb58a262b6c9b1", 
        "name": "Pyihtaungsu Hluttaw Joint Public Accounts Committee"
    }, 
    {
        "id": "b3d8c684703d4823a001348f7d85ac47", 
        "name": "Amyotha Hluttaw Local and International Non-Government Organizations Committee"
    }, 
    {
        "id": "a2f161a549264daeb6249673f87c6c59", 
        "name": "Amyotha Hluttaw Hluttaw Rights Committee"
    }, 
    {
        "id": "8576becf022c4ee7b1967d970d4c3950", 
        "name": "Pyithu Hluttaw Transportation, Communications and Construction Committee"
    }, 
    {
        "id": "61d48120ad8640ab916594730b626655", 
        "name": "Pyithu Hluttaw Hluttaw Rights Committee"
    }, 
    {
        "id": "2de08121d5cb4041b3d6e6894ebe161e", 
        "name": "Pyidaungsu Hluttaw Joint Bill Committee"
    }, 
    {
        "id": "aa3a9188960b448f97a603ebed6bf348", 
        "name": "Amyotha Hluttaw Women and Children's Rights Committee"
    }, 
    {
        "id": "01ba26d878c24f3eb5a96393e0a2b10f", 
        "name": "Amyotha Hluttaw Farmer Affairs Committee"
    }, 
    {
        "id": "5ef2e90de6ea44e8adf14893fbec5aa3", 
        "name": "Amyotha Hluttaw Public Complaints Committee"
    }, 
    {
        "id": "7c8459138847493c8692141a6454c4b7", 
        "name": "Amyotha Hluttaw Health, Sports and Culture Committee"
    }, 
    {
        "id": "30cf506ca013453894e17436b97213ba", 
        "name": "Amyotha Hluttaw Ethnic Affairs Committee"
    }, 
    {
        "id": "211035b322ce423b90eb762f3f6e688f", 
        "name": "Pyidaungsu Hluttaw Joint Committee on ASEAN Inter-Parliamentary Union"
    }, 
    {
        "id": "72ad744971954112b35c1674168bf5bc", 
        "name": "Pyithu Hluttaw Bill Committee"
    }, 
    {
        "id": "9ca0a682c2c44635a7ad93ab9ea64823", 
        "name": "Amyotha Hluttaw Public Accounts Committee"
    }, 
    {
        "id": "2a8adcac7f4642b292b3df77030f63a2", 
        "name": "Pyithu Hluttaw International Relations Committee"
    }, 
    {
        "id": "62b9b87849a54455a5fca549460f18c2", 
        "name": "Amyotha Hluttaw Government\u2019s Guarantees, Pledges and Undertakings Vetting Committee"
    }, 
    {
        "id": "c2c30fc869214684a3bf9fda6930fb97", 
        "name": "Amyotha Hluttaw International Relations, Inter-parlimentary Relations and Cooperation Committee"
    }, 
    {
        "id": "35b1fbf1b87943c98b7aacb5516c5c51", 
        "name": "Pyithu Hluttaw Banks and Monetary Affairs Development Committee"
    }, 
    {
        "id": "7a4b6e6658264f4c833ea0d553272bf6", 
        "name": "Amyotha Hluttaw Education Promotion Committee"
    }, 
    {
        "id": "9f3448056d2b48e1805475a45a4ae1ed", 
        "name": "Amyotha Hluttaw Local and Overseas Employment Committee"
    }
]

In [32]:
#Looking up a specific committee will list down all members and persons details, a committee is just
#organization class same as party, same as upper house, lower house

#"name": "Amyotha Hluttaw Local and Overseas Employment Committee"
r = requests.get('http://api.openhluttaw.org/en/organizations/9f3448056d2b48e1805475a45a4ae1ed')
committee = r.json()['result']

#List committee members

# missing on behalf_of expanded for organizations https://github.com/Sinar/popit_ng/issues/200
for member in committee['memberships']:
    print member['person']['id']
    print member['person']['name']
    print member['person']['image']


f71eabf133304bcb88d062e1e59e6662
Okkar Min
http://goo.gl/v1uqUl
fd24165b8e814a758cd1098dc7a9038a
8cfb16ee217c4c12b8f0ba2a382c1f90
Moe Moe Htwe
http://goo.gl/s5mofI
fd24165b8e814a758cd1098dc7a9038a
3c529c34c4ab4f9a80c6b4143fbc791b
Ei Ei Pyone
http://goo.gl/cbEKgU
fd24165b8e814a758cd1098dc7a9038a
a25555c4289340e58374ca1c4ca916c4
Pan Pha
http://goo.gl/SnEhRZ
fd24165b8e814a758cd1098dc7a9038a
05566867e79541a89c872da5f6988099
Soe Thiha
http://goo.gl/SWsrvI
fd24165b8e814a758cd1098dc7a9038a
bbdc84b5d8b943a0b013c9fa31ef8534
Zaw Min Latt (or) Ko Latt
http://goo.gl/b0uucr
fd24165b8e814a758cd1098dc7a9038a
17e40c6583c84eb3a75fb05f068d913f
Kyaw Htwe
http://goo.gl/QfwN0T
fd24165b8e814a758cd1098dc7a9038a
9076b512e6834859addb1098e8944bcd
Min Naing
http://goo.gl/rd1X4c
fd24165b8e814a758cd1098dc7a9038a
1f6507ea4bf64f9d9b87c7191f772649
Kywe Kywe
http://goo.gl/Trfvzo
fd24165b8e814a758cd1098dc7a9038a
3c40ad0e5ca34373a87845f3fb579477
Hla San
http://goo.gl/KSw7ix
fd24165b8e814a758cd1098dc7a9038a
ffd321c2164043959687d1dba9417348
Kyaw Than
http://goo.gl/Ov7tGX
016a8ad7b40343ba96e0c03f47019680
64587fd105904ce7a22d16c737e5d843
Khin Ma Gyi
http://goo.gl/ieZq1T
fd24165b8e814a758cd1098dc7a9038a
c08a4d1bc1a64c658e73772d583b740a
Kyi Win
http://goo.gl/nJlG3r
fd24165b8e814a758cd1098dc7a9038a

Party


In [36]:
#List all committees

query = 'classification:Party'
r = requests.get('http://api.openhluttaw.org/en/search/organizations?q='+query)
pages = r.json()['num_pages']


parties = []
for page in range(1,pages+1):
    r = requests.get('http://api.openhluttaw.org/en/search/organizations?q='+query+'&page='+str(page))
    orgs = r.json()['results']
    for org in orgs:
        parties.append(org)

In [38]:
# BUG in https://github.com/Sinar/popit_ng/issues/197
# use JSON party lookup below to lookup values directly on client side

for party in parties:
    print party['name']


Pao National Organization
Kachin Democratic Party
Zomi Congress for Democracy
Ta'Arng Palaung National Party
National Unity Party
Lisu National Development Party
Rakhine National Party
Shan Nationalities League for Democracy
Kokang Democracy and Unity Party
Mon National Party
[
    {
        "id": "fd24165b8e814a758cd1098dc7a9038a", 
        "name": "National League for Democracy"
    }, 
    {
        "id": "9462adf5cffa41c386e621fee28c59eb", 
        "name": "Union Solidarity and Development Party"
    }, 
    {
        "id": "7997379fe27c4e448af522c85e306bfb", 
        "name": "\"Wa\" Democratic Party"
    }, 
    {
        "id": "90e4903937bf4b8ba9185157dde06345", 
        "name": "Kokang Democracy and Unity Party"
    }, 
    {
        "id": "2d2c795149c74b6f91cdea8caf28e968", 
        "name": "Zomi Congress for Democracy"
    }, 
    {
        "id": "b366273152a84d579c4e19b14d36c0b5", 
        "name": "Ta'Arng Palaung National Party"
    }, 
    {
        "id": "f2189158953e4d9e9296efeeffe7cf35", 
        "name": "National Unity Party"
    }, 
    {
        "id": "d53d27fef3ac4b2bb4b7bf346215f626", 
        "name": "Pao National Organization"
    }, 
    {
        "id": "2f0c09d5eb05432d8fcf247b5cb1885f", 
        "name": "Mon National Party"
    }, 
    {
        "id": "dc69205c7eb54a7aaf68b3d2e3d9c23e", 
        "name": "Rakhine National Party"
    }, 
    {
        "id": "e67bf2cdb4ff4ce89167cba3a514a6df", 
        "name": "Shan Nationalities League for Democracy"
    }, 
    {
        "id": "a7a1ac9d2f20470d87e556af41dfaa19", 
        "name": "Lisu National Development Party"
    }, 
    {
        "id": "8cc2d69bed8743bbaa229b164afecf9a", 
        "name": "Independent"
    }, 
    {
        "id": "016a8ad7b40343ba96e0c03f47019680", 
        "name": "Arakan National Party"
    }, 
    {
        "id": "6e76561e385946e0a3761d4f25293912", 
        "name": "The Taaung (Palaung) National Party"
    }, 
    {
        "id": "63ec5681df974c67b7a217873fa9cdf5", 
        "name": "Kachin Democratic Party"
    }
]

In [52]:
#Listing people by party in org Amyotha 897739b2831e41109713ac9d8a96c845
#Pyithu org id would be 7f162ebef80e4a4aba12361ea1151fce
#We list by membership and specific organization_id and on_behalf_of_id of parties above

#Amyotha Members represented by Arakan National Party
query = 'organization_id:897739b2831e41109713ac9d8a96c845 AND on_behalf_of_id:016a8ad7b40343ba96e0c03f47019680'
r = requests.get('http://api.openhluttaw.org/en/search/memberships?q='+query)
pages = r.json()['num_pages']

memberships = []
for page in range(1,pages+1):
    r = requests.get('http://api.openhluttaw.org/en/search/memberships?q='+query+'&page='+str(page))
    members = r.json()['results']
    for member in members:
        memberships.append(member)

for member in memberships:
    print member['post']['label']
    print member['person']['id']
    print member['person']['name']
    print member['person']['image']


Rakhine-11
523a9c3262284ed386d8db974332c042
Htu May
http://goo.gl/3gnGYR
Rakhine-4
f4c96514947240e09247e9f92c4f8560
Kyaw Kyaw
http://goo.gl/enblUh
Rakhine-9
cab0185fcf20472fb735be142c7ce61c
Maung Kyaw Zan
http://goo.gl/BOjVu0
Rakhine-6
aa016ca37dc04272a38745ad5bd81f96
Aye Tha Aung
http://goo.gl/aghwMf
Rakhine-10
ffd321c2164043959687d1dba9417348
Kyaw Than
http://goo.gl/Ov7tGX
Rakhine-2
5c01649cfb684afeb4967202e7889bb6
Tet Tun Aung
http://goo.gl/bqggba
Rakhine-3
ae15e763430248e99c2ff0195e552c17
Khin Maung Latt
http://goo.gl/xfnvon
Rakhine-8
34d9e8e9a43c4e1489820ac17483fad5
Kyaw Kyaw Win
None
Rakhine-5
de1a906e468e46a9a95b34a22c286a58
Myint Naing
http://goo.gl/Be7NW1
Rakhine-1
a7e38035d97940fa939f09333ead1a46
Wai Sein Aung
http://goo.gl/1pTPcL