<s> import requests <EOL> import json <EOL> import sys <EOL> import os <EOL> import conn <EOL> import extra_functions <EOL> import storage_volume <EOL> os . system ( '<STR_LIT>' ) <EOL> if extra_functions . volume_check ( ) == False : <EOL> storage_volume . post ( ) <EOL> headers = conn . headers <EOL> auth = conn . auth <EOL> url = conn . url + '<STR_LIT>' <EOL> payload = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" <EOL> } <EOL> def get ( ) : <EOL> print '<STR_LIT>' <EOL> r = requests . get ( url , auth = auth ) <EOL> if r . status_code == <NUM_LIT:200> : <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>' <EOL> for items in result [ i ] : <EOL> print items + '<STR_LIT::>' , result [ i ] [ items ] <EOL> print '<STR_LIT>' <EOL> else : <EOL> print '<STR_LIT>' <EOL> def post ( ) : <EOL> r = requests . get ( url , auth = auth ) <EOL> result = json . loads ( r . text ) <EOL> if len ( result ) > <NUM_LIT:0> : <EOL> delete ( ) <EOL> r = requests . post ( url , auth = auth , data = json . dumps ( payload ) , headers = headers ) <EOL> if r . status_code == <NUM_LIT> : <EOL> result = json . loads ( r . text ) <EOL> print '<STR_LIT>' <EOL> return str ( result [ '<STR_LIT:id>' ] ) + '<STR_LIT:/>' <EOL> else : <EOL> print '<STR_LIT>' <EOL> return '<STR_LIT>' <EOL> def put ( ) : <EOL> id = post ( ) <EOL> r = requests . put ( url + id , auth = auth , data = json . dumps ( payload ) , headers = headers ) <EOL> if r . status_code == <NUM_LIT:200> : <EOL> print '<STR_LIT>' <EOL> else : <EOL> print '<STR_LIT>' <EOL> def delete ( ) : <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> r = requests . delete ( url + str ( result [ i ] [ '<STR_LIT:id>' ] ) + '<STR_LIT:/>' , auth = auth ) <EOL> if r . status_code == <NUM_LIT> : <EOL> print '<STR_LIT>' <EOL> else : <EOL> print '<STR_LIT>' <EOL> if len ( result ) == <NUM_LIT:0> : <EOL> id = post ( ) <EOL> r = requests . delete ( url + id , auth = auth ) <EOL> if r . status_code == <NUM_LIT> : <EOL> print '<STR_LIT>' <EOL> else : <EOL> print '<STR_LIT>' </s>
