How to use mpcontribs-client - 3 common examples

To help you get started, we’ve selected a few mpcontribs-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github materialsproject / MPContribs / mpcontribs-client / mpcontribs / client / __init__.py View on Github external
def load(self):
        http_client = FidoClientGlobalHeaders(headers=self.headers)
        loader = Loader(http_client)
        protocol = "https" if self.apikey else "http"
        origin_url = f"{protocol}://{self.host}/apispec.json"
        spec_dict = loader.load_spec(origin_url)
        spec_dict["host"] = self.host
        spec_dict["schemes"] = [protocol]

        config = {
            "validate_responses": False,
            "use_models": False,
            "include_missing_properties": False,
            "formats": [email_format, url_format],
        }
        bravado_config = bravado_config_from_config_dict(config)
        for key in set(bravado_config._fields).intersection(set(config)):
            del config[key]
github materialsproject / MPContribs / mpcontribs-client / mpcontribs / client / __init__.py View on Github external
def get_contribution(self, cid):
        """Convenience function to get full contribution entry and display as HTML table"""
        fields = list(
            self.swagger_spec.definitions.get("ContributionsSchema")._properties.keys()
        )  # don't return dynamic fields (card_*)
        return Dict(self.contributions.get_entry(pk=cid, _fields=fields).result())
github materialsproject / MPContribs / mpcontribs-client / mpcontribs / client / __init__.py View on Github external
def get_project(self, project):
        """Convenience function to get full project entry and display as HTML table"""
        return Dict(self.projects.get_entry(pk=project, _fields=["_all"]).result())

mpcontribs-client

client library for MPContribs API

MIT
Latest version published 1 month ago

Package Health Score

75 / 100
Full package analysis

Similar packages