Пример #1
0
def main():
	authority_url = 'https://login.windows.net/[Your Tenant]'
	client_id = '[Your client_id]'
	client_secret = '[Your secret]'
	context = adal.AuthenticationContext(authority_url,api_version=None)
	token = context.acquire_token_with_client_credentials(client_id,client_id,client_secret)
	api_client = ApiClient();
	#api_client.configuration.host = "[Set this if custom host and port is needed]"
	bearer_token = "Bearer "+token['accessToken']
	api_client.set_default_header('Authorization',bearer_token)
	api_user = swagger_client.UsersApi(api_client)
	me = api_user.me_get()	
	pprint(me)
Пример #2
0
from swagger_client.configuration import Configuration

from nose.tools import assert_equals
from testconfig import config
from waiting import wait

import msgpack
import base58
import rlp

EXT_API = {}
for node, node_config in config['nodes'].iteritems():
    empty_config = Configuration()
    empty_config.host = node_config['host'] + ':' + str(
        node_config['ports']['external_api']) + '/v2'
    EXT_API[node] = ExternalApi(ApiClient(empty_config))

INT_API = {}
for node, node_config in config['nodes'].iteritems():
    empty_config = Configuration()
    empty_config.host = node_config['host'] + ':' + str(
        node_config['ports']['internal_api']) + '/v2'
    INT_API[node] = InternalApi(ApiClient(empty_config))


def external_api(name):
    return EXT_API[name]


def internal_api(name):
    return INT_API[name]
Пример #3
0
 def __init__(self, api_client=None):
     if api_client is None:
         api_client = ApiClient()
     self.api_client = api_client
Пример #4
0
from swagger_client.api_client import ApiClient
from swagger_client.configuration import Configuration
from swagger_client.api.default_api import DefaultApi
from swagger_client.models.message import Message

config = Configuration(host="localhost")
client = ApiClient(configuration=config)
api = DefaultApi(api_client=client)

message = Message(contenu="Hello world", emetteur="Quentin")
api.messages_post(body=message)

messages = api.messages_get()
print(messages)