<s> import requests <EOL> import json <EOL> import sys <EOL> sys . path . append ( '<STR_LIT>' ) <EOL> import conn <EOL> auth = conn . auth <EOL> headers = conn . headers <EOL> url = conn . url + '<STR_LIT>' <EOL> payload = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } <EOL> def template_get ( ) : <EOL> r = requests . get ( url , auth = auth ) <EOL> result = json . loads ( r . text ) <EOL> i = <NUM_LIT:0> <EOL> for i in range ( <NUM_LIT:0> , len ( result ) ) : <EOL> print '<STR_LIT:\n>' <EOL> for items in result [ i ] : <EOL> print items + '<STR_LIT::>' , result [ i ] [ items ] <EOL> def template_post ( ) : <EOL> r = requests . post ( url , auth = auth , data = json . dumps ( payload ) , headers = headers ) <EOL> result = json . loads ( r . text ) <EOL> for items in result : <EOL> print items + '<STR_LIT::>' , result [ items ] <EOL> def template_put ( ) : <EOL> id = raw_input ( '<STR_LIT>' ) + '<STR_LIT:/>' <EOL> r = requests . put ( url + id , auth = auth , data = json . dumps ( payload ) , headers = headers ) <EOL> result = json . loads ( r . text ) <EOL> for items in result : <EOL> print items + '<STR_LIT::>' , result [ items ] <EOL> def template_delete ( ) : <EOL> id = raw_input ( '<STR_LIT>' ) + '<STR_LIT:/>' <EOL> r = requests . delete ( url + id , auth = auth ) <EOL> print r . status_code <EOL> while ( <NUM_LIT:1> ) : <EOL> method = raw_input ( '<STR_LIT>' ) <EOL> if method == '<STR_LIT>' : <EOL> template_get ( ) <EOL> elif method == '<STR_LIT>' : <EOL> template_post ( ) <EOL> elif method == '<STR_LIT>' : <EOL> template_put ( ) <EOL> elif method == '<STR_LIT>' : <EOL> template_delete ( ) </s>
