<s> import furl <EOL> from website . util . client import BaseClient <EOL> from . import utils <EOL> class EzidClient ( BaseClient ) : <EOL> BASE_URL = '<STR_LIT>' <EOL> def __init__ ( self , username , password ) : <EOL> self . username = username <EOL> self . password = password <EOL> def _build_url ( self , * segments , ** query ) : <EOL> url = furl . furl ( self . BASE_URL ) <EOL> url . path . segments . extend ( segments ) <EOL> url . args . update ( query ) <EOL> return url . url <EOL> @ property <EOL> def _auth ( self ) : <EOL> return ( self . username , self . password ) <EOL> @ property <EOL> def _default_headers ( self ) : <EOL> return { '<STR_LIT:Content-Type>' : '<STR_LIT>' } <EOL> def get_identifier ( self , identifier ) : <EOL> resp = self . _make_request ( <EOL> '<STR_LIT:GET>' , <EOL> self . _build_url ( '<STR_LIT:id>' , identifier ) , <EOL> expects = ( <NUM_LIT:200> , ) , <EOL> ) <EOL> return utils . from_anvl ( resp . content . strip ( '<STR_LIT:\n>' ) ) <EOL> def create_identifier ( self , identifier , metadata = None ) : <EOL> resp = self . _make_request ( <EOL> '<STR_LIT>' , <EOL> self . _build_url ( '<STR_LIT:id>' , identifier ) , <EOL> data = utils . to_anvl ( metadata or { } ) , <EOL> expects = ( <NUM_LIT> , ) , <EOL> ) <EOL> return utils . from_anvl ( resp . content ) <EOL> def mint_identifier ( self , shoulder , metadata = None ) : <EOL> resp = self . _make_request ( <EOL> '<STR_LIT:POST>' , <EOL> self . _build_url ( '<STR_LIT>' , shoulder ) , <EOL> data = utils . to_anvl ( metadata or { } ) , <EOL> expects = ( <NUM_LIT> , ) , <EOL> ) <EOL> return utils . from_anvl ( resp . content ) </s>
