from flask import request from pyispyb.flask_restx_patched import Resource, HTTPStatus from pyispyb.app.extensions.api import api_v1, Namespace from pyispyb.app.extensions.auth import token_required, authorization_required from pyispyb.core.schemas import person as person_schemas from pyispyb.core.schemas import lab_contact as lab_contact_schemas from pyispyb.core.schemas import laboratory as laboratory_schemas from pyispyb.core.modules import contacts __license__ = "LGPLv3+" api = Namespace("Contacts", description="Contact related namespace", path="/contacts") api_v1.add_namespace(api) @api.route("/persons", endpoint="persons") @api.doc(security="apikey") class Persons(Resource): """Allows to get all persons""" @token_required @authorization_required def get(self): """Returns all persons""" return contacts.get_persons(request) @api.expect(person_schemas.f_schema)
from flask import request from pyispyb.flask_restx_patched import Resource, HTTPStatus from pyispyb.app.extensions.api import api_v1, Namespace from pyispyb.app.extensions.auth import token_required, authorization_required from pyispyb.core.schemas import data_collection as data_collection_schemas from pyispyb.core.modules import data_collection __license__ = "LGPLv3+" api = Namespace( "Data collections", description="Data collection related namespace", path="/data_collections", ) api_v1.add_namespace(api) @api.route("") @api.doc(security="apikey") class DataColletions(Resource): """Allows to get all data_collections""" # @api.marshal_list_with(data_collection_schemas.data_collection_f_schema, skip_none=False, code=HTTPStatus.OK) # TODO Define model with JSON Schema @token_required @authorization_required def get(self):
""" __license__ = "LGPLv3+" from flask import request, current_app from flask_restx._http import HTTPStatus from pyispyb.flask_restx_patched import Resource from pyispyb.app.extensions.api import api_v1, Namespace from pyispyb.app.extensions.auth import token_required, authorization_required from pyispyb.core.schemas import proposal as proposal_schemas from pyispyb.core.modules import proposal api = Namespace("Proposals", description="Proposal related namespace", path="/proposals") api_v1.add_namespace(api) @api.route("", endpoint="proposals") @api.doc(security="apikey") class Proposals(Resource): """Allows to get all proposals""" @token_required @authorization_required def get(self): """Returns proposals based on query parameters""" api.logger.info("Get all proposals") return proposal.get_proposals(request)
from flask import request from pyispyb.flask_restx_patched import Resource, HTTPStatus from pyispyb.app.extensions.api import api_v1, Namespace from pyispyb.app.extensions.auth import token_required, authorization_required from pyispyb.core.schemas import sample as sample_schemas from pyispyb.core.schemas import crystal as crystal_schemas from pyispyb.core.schemas import protein as protein_schemas from pyispyb.core.schemas import diffraction_plan as diffraction_plan_schemas from pyispyb.core.modules import sample, crystal, diffraction_plan, protein __license__ = "LGPLv3+" api = Namespace("Samples", description="Sample related namespace", path="/samples") api_v1.add_namespace(api) @api.route("", endpoint="samples") @api.doc(security="apikey") class Sample(Resource): """Sample resource""" @token_required @authorization_required def get(self): """Returns all sample items""" return sample.get_samples(request) @token_required
from flask import request from pyispyb.flask_restx_patched import Resource, HTTPStatus, abort from pyispyb.app.extensions.api import api_v1, Namespace from pyispyb.app.extensions.auth import token_required, authorization_required from pyispyb.core.schemas import beamline_setup as beamline_setup_schemas from pyispyb.core.schemas import robot_action as robot_action_schemas from pyispyb.core.schemas import detector as detector_schemas from pyispyb.core.modules import beamline_setup, robot_action, detector __license__ = "LGPLv3+" log = logging.getLogger(__name__) api = Namespace("Beamline", description="Beamline related namespace", path="/beamline") api_v1.add_namespace(api) @api.route("/setups", endpoint="beamline_setup") @api.doc(security="apikey") class BeamlineSetups(Resource): """Allows to get all beamline_setups and insert a new one""" @token_required @authorization_required def get(self): """Returns list of beamline_setups""" return beamline_setup.get_beamline_setups(request) @api.expect(beamline_setup_schemas.f_schema)
""" __license__ = "LGPLv3+" from flask import request, current_app from flask_restx._http import HTTPStatus from pyispyb.flask_restx_patched import Resource from pyispyb.app.extensions.api import api_v1, Namespace from pyispyb.app.extensions.auth import token_required, authorization_required #from pyispyb.core.schemas import phasing_program_run as phasing_program_run_schemas from pyispyb.core.modules import phasing api = Namespace("Phasing", description="Phasing related namespace", path="/phasing") api_v1.add_namespace(api) @api.route("", endpoint="phasing_results") @api.doc(security="apikey") class PhasingResults(Resource): """Allows to get all phasing_results""" #@token_required #@authorization_required def get(self): """Returns phasing_results based on query parameters""" api.logger.info("Get all phasing_results")
from flask import request from pyispyb.flask_restx_patched import Resource, HTTPStatus, abort from pyispyb.app.extensions.api import api_v1, Namespace from pyispyb.app.extensions.auth import token_required, authorization_required from pyispyb.core.schemas import session as session_schemas from pyispyb.core.schemas import beam_calendar as beam_calendar_schemas from pyispyb.core.modules import session __license__ = "LGPLv3+" log = logging.getLogger(__name__) api = Namespace("Sessions", description="Session related namespace", path="/sessions") api_v1.add_namespace(api) @api.route("", endpoint="sessions") @api.doc(security="apikey") class Sessions(Resource): """Allows to get all sessions and insert a new one""" @token_required @authorization_required def get(self): """Returns list of sessions""" return session.get_sessions(request) @api.expect(session_schemas.f_schema)
from flask import request from flask_restx._http import HTTPStatus from pyispyb.flask_restx_patched import Resource from pyispyb.app.extensions.auth import token_required, authorization_required from pyispyb.app.extensions.api import api_v1, Namespace from pyispyb.core.modules import container, dewar, shipping from pyispyb.core.schemas import container as container_schemas from pyispyb.core.schemas import dewar as dewar_schemas from pyispyb.core.schemas import shipping as shipping_schemas __license__ = "LGPLv3+" api = Namespace("Shipments", description="Shipment related namespace", path="/shipments") api_v1.add_namespace(api) @api.route("", endpoint="shipments") @api.doc(security="apikey") class Shipments(Resource): """Allows to get all shipments""" @token_required @authorization_required def get(self): """Returns list of shipments""" return shipping.get_shipments(request), HTTPStatus.OK @api.expect(shipping_schemas.f_schema)
""" __license__ = "LGPLv3+" from flask import request, current_app from flask_restx._http import HTTPStatus from pyispyb.flask_restx_patched import Resource from pyispyb.app.extensions.api import api_v1, Namespace from pyispyb.app.extensions.auth import token_required, authorization_required from pyispyb.em.schemas import motion_correction as motion_correction_schemas from pyispyb.em.modules import motion_correction api = Namespace("Motion correction", description="Motion correction namespace", path="/motion_correction") api_v1.add_namespace(api) @api.route("", endpoint="motion_correction") @api.doc(security="apikey") class MotionCorrections(Resource): """Allows to get all motion_corrections""" @token_required @authorization_required def get(self): """Returns motion_corrections based on query parameters""" api.logger.info("Get all motion_corrections") return "Test"
# GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with py-ispyb. If not, see <http://www.gnu.org/licenses/>. from flask import request, make_response from pyispyb.flask_restx_patched import Resource from pyispyb.app.extensions.api import api_v1, Namespace from pyispyb.app.extensions import auth_provider __license__ = "LGPLv3+" api = Namespace("Authentication", description="authentication namespace", path="/auth") api_v1.add_namespace(api) @api.route("/login") class Login(Resource): """Login resource""" def get(self): authorization = request.authorization if (not authorization or not authorization.username or not authorization.password): if not request.headers.get("username") or not request.headers.get( "password"): return make_response(
from pyispyb.app.extensions.auth import token_required, authorization_required from pyispyb.core.schemas import auto_proc as auto_proc_schemas from pyispyb.core.schemas import auto_proc_program as auto_proc_program_schemas from pyispyb.core.schemas import ( auto_proc_program_attachment as auto_proc_program_attachment_schemas, ) #from pyispyb.core.schemas import ( # auto_proc_program_message as auto_proc_program_message_schemas, #) from pyispyb.core.schemas import auto_proc_status as auto_proc_status_schemas from pyispyb.core.modules import auto_proc __license__ = "LGPLv3+" api = Namespace("Auto processing", description="Auto processing related namespace", path="/autoproc") api_v1.add_namespace(api) @api.route("", endpoint="auto_procs") @api.doc(security="apikey") class AutoProcs(Resource): """Allows to get all auto proc entries""" @token_required @authorization_required def get(self): """Returns auto proc entries""" return auto_proc.get_auto_procs(request)
You should have received a copy of the GNU Lesser General Public License along with py-ispyb. If not, see <http://www.gnu.org/licenses/>. """ import importlib from flask import current_app from pyispyb.flask_restx_patched import Resource, HTTPStatus from pyispyb.app.extensions.api import api_v1, Namespace # from pyispyb.app.extensions.auth import token_required from pyispyb.core import schemas __license__ = "LGPLv3+" api = Namespace("Schemas", description="Schemas related namespace", path="/schemas") api_v1.add_namespace(api) @api.route("/available_names", endpoint="available_schemas_names") class SchemasList(Resource): # @token_required def get(self): """Returns list of available schemas Returns: list: list of names """ current_app.logger.info("Get all schemas")
along with py-ispyb. If not, see <http://www.gnu.org/licenses/>. """ from flask import request, current_app from flask_restx._http import HTTPStatus from pyispyb.flask_restx_patched import Resource from pyispyb.app.extensions.api import api_v1, Namespace from pyispyb.app.extensions.auth import token_required, authorization_required from pyispyb.app.extensions.user_office_link import user_office_link __license__ = "LGPLv3+" api = Namespace("User office", description="User office related namespace", path="/user_office") api_v1.add_namespace(api) @api.route("/sync_all", endpoint="user_office_sync_all") @api.doc(security="apikey") class SyncAll(Resource): """Sync with user office""" @token_required @authorization_required def post(self): """Sync with user office""" api.logger.info("Sync with uer office") user_office_link.sync_with_user_office()