nerdz-api

command module
v0.0.0-...-f7ec041 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2024 License: AGPL-3.0 Imports: 7 Imported by: 0

README

NERDZ API

This repository contains the API of nerdz (incredible). Swagger-generated documentation available at: https://api.nerdz.eu/docs

Create a client

After having registered an application on NERDZ, you can use the OAuth2 authorization flow to get the correct tokens. The following is a minimal example in Python that shows how to interact with the NERDZ API.

import logging
from oauth2_client.credentials_manager import (CredentialManager,
                                               ServiceInformation)

logging.basicConfig(level=logging.DEBUG)
_logger = logging.getLogger("client")

scopes = ["pms:read", "pms:write"]
service_information = ServiceInformation(
    "https://api.nerdz.eu/v1/oauth2/authorize",
    "https://api.nerdz.eu/v1/oauth2/token",
    "1",  # client_id
    "$2a$07$F4HMU60OX0Tc5bsufMOY7OZBXjItcd7VzmN2r89Uwezf0Fasdasd",  # client_secret
    scopes,
)

manager = CredentialManager(service_information)
redirect_uri = "http://localhost:8080/oauth/code"

# Builds the authorization url and starts the local server according to the redirect_uri parameter
url = manager.init_authorize_code_process(redirect_uri, "state_test")
_logger.info("Open this url in your browser\n%s", url)
code = manager.wait_and_terminate_authorize_code_process()
_logger.debug("Code got = %s", code)
manager.init_with_authorize_code(redirect_uri, code)
_logger.debug("Access got = %s", manager._access_token)

Contributing

If you want to contribute, you should be at least a NERDZ user.

Developers can go to doc/CONTRIBUTING.md to see the developer's guide to NERDZ-API.

License

Copyright (C) 2016-2020 Paolo Galeone; nessuno@nerdz.eu

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Documentation

Overview

Package main NERDZ API.

this application provides API for the NERDZ Social Networking Platform.

Terms of Service:

there are no TOS at this moment, use at your own risk we take no responsibility

	Schemes: https
	Host: api.nerdz.eu
 BasePath: /v1
 Version: 1
 License: AGPL http://www.gnu.org/licenses/
 Contact: Paolo Galeone<nessuno@nerdz.eu> https://www.nerdz.eu/nessuno.

	Consumes:
		- application/json

 Produces:
		- application/json

swagger:meta

Directories

Path Synopsis
me

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL