21
21
from pydgraph .proto import api_pb2 as api
22
22
23
23
__author__ = 'Anurag Sharma <[email protected] >'
24
- __maintainer__ = 'Martin Martinez Rivera <martinmr @dgraph.io>'
24
+ __maintainer__ = 'Arpan Gupta <arpan @dgraph.io>'
25
25
__version__ = VERSION
26
26
__status__ = 'development'
27
27
@@ -30,22 +30,22 @@ class SlashGraphQLClient(object):
30
30
"""Creates a new Client for interacting with the Slash GraphQL.
31
31
"""
32
32
33
- def __init__ (self , SlashEndpoint , APIKey ):
34
- if not SlashEndpoint :
33
+ def __init__ (self , slash_end_point , api_key ):
34
+ if not slash_end_point :
35
35
raise ValueError ('No Slash endpoint provided in SlashGraphQLClient constructor' )
36
36
37
- self ._SlashEndpoint = SlashEndpoint
38
- self ._APIKey = APIKey
37
+ self ._slash_end_point = slash_end_point
38
+ self ._api_key = api_key
39
39
40
40
def get_stub (self ):
41
41
"""Returns Dgraph Client stub for the Slash GraphQL endpoint"""
42
- url = self ._SlashEndpoint .replace ("/graphql" , "" )
42
+ url = self ._slash_end_point .replace ("/graphql" , "" )
43
43
url = url .replace ("https://" , "" )
44
44
url_parts = url .split ("." , 1 )
45
- HOST = url_parts [0 ] + ".grpc." + url_parts [1 ]
45
+ host = url_parts [0 ] + ".grpc." + url_parts [1 ]
46
46
PORT = "443"
47
47
creds = grpc .ssl_channel_credentials ()
48
- call_credentials = grpc .metadata_call_credentials (lambda context , callback : callback ((("authorization" , self ._APIKey ),), None ))
48
+ call_credentials = grpc .metadata_call_credentials (lambda context , callback : callback ((("authorization" , self ._api_key ),), None ))
49
49
composite_credentials = grpc .composite_channel_credentials (creds , call_credentials )
50
- client_stub = pydgraph .DgraphClientStub ('{host}:{port}' .format (host = HOST , port = PORT ), composite_credentials , options = (('grpc.enable_http_proxy' , 0 ),))
50
+ client_stub = pydgraph .DgraphClientStub ('{host}:{port}' .format (host = host , port = PORT ), composite_credentials , options = (('grpc.enable_http_proxy' , 0 ),))
51
51
return client_stub
0 commit comments