def create_address():
    """
    Create a new address owned by your user.
    ---
    parameters:
      - name: address
        in: body
        description: The pseudo-address you would like to create. i.e. currency and network
        required: true
        schema:
          $ref: '#/definitions/Address'
    responses:
      '200':
        description: Your new address
        schema:
          $ref: '#/definitions/Address'
      default:
        description: unexpected error
        schema:
          $ref: '#/definitions/errorModel'
    security:
      - kid: []
      - typ: []
      - alg: []
    operationId: createAddress
    """
    currency = request.jws_payload['data'].get('currency')
    network = request.jws_payload['data'].get('network')
    state = 'active'
    if network.lower() in ps:
        try:
            addy = ps[network.lower()].get_new_address()
        except Exception as e:
            print type(e)
            print e
            current_app.logger.error(e)
            return 'wallet temporarily unavailable', 500
    else:
        return 'Invalid network', 400
    address = wm.Address(addy, currency, network, state, current_user.id)
    ses.add(address)
    try:
        ses.commit()
    except Exception as ie:
        ses.rollback()
        ses.flush()
        return 'Could not save address', 500
    newaddy = json.loads(jsonify2(address, 'Address'))
    current_app.logger.info("created new address %s" % newaddy)
    ses.close()
    return current_app.bitjws.create_response(newaddy)
def create_address ( ) : currency = request . jws_payload [ 'data' ] . get ( 'currency' ) network = request . jws_payload [ 'data' ] . get ( 'network' ) state = 'active' if network . lower ( ) in ps : try : addy = ps [ network . lower ( ) ] . get_new_address ( ) except Exception as e : print type ( e ) print e current_app . logger . error ( e ) return 'wallet temporarily unavailable' , 500 else : return 'Invalid network' , 400 address = wm . Address ( addy , currency , network , state , current_user . id ) ses . add ( address ) try : ses . commit ( ) except Exception as ie : ses . rollback ( ) ses . flush ( ) return 'Could not save address' , 500 newaddy = json . loads ( jsonify2 ( address , 'Address' ) ) current_app . logger . info ( "created new address %s" % newaddy ) ses . close ( ) return current_app . bitjws . create_response ( newaddy )
Create a new address owned by your user.
    ---
    parameters:
      - name: address
        in: body
        description: The pseudo-address you would like to create. i.e. currency and network
        required: true
        schema:
          $ref: '#/definitions/Address'
    responses:
      '200':
        description: Your new address
        schema:
          $ref: '#/definitions/Address'
      default:
        description: unexpected error
        schema:
          $ref: '#/definitions/errorModel'
    security:
      - kid: []
      - typ: []
      - alg: []
    operationId: createAddress