Skip to content

Commit 6436d92

Browse files
committed
add auth header, and typo
1 parent 420de0c commit 6436d92

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

docs/notesfaq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
The following questions have come up in previous conversations:
44

55
- **Why is the SDK camel-cased?** True, Python code should be snake-cased. This was a design decision to align all the SDKS. All the functions and fields should look the same, so you can easily switch from one language to another without having to read documentation. This may change in the future as we grow the SDKs.
6-
- **Which user should I use?** The `guest@navability.io` user is open and free for everyone to use. We recommend testing with this user, because it doesn't require any authentication. Note though, that the data is cleared on a regular basis, and that everyone can see your test data (all Guest users are created equal), so don't put anything in there that that is sensitive.
6+
- **Which user should I use?** The `guest@navability.io` user is open and free for everyone to use. We recommend testing with this user, because it doesn't require any authentication. Note though, that the data is cleared on a regular basis, and that everyone can see your test data (all Guest users are created equal), so don't put anything in there that is sensitive.
77
- **I have sensitive data, how do I create a user?** Great question, the NavAbility services completely isolate data per user and you can create a user at any point. At the moment we create users on demand because the services are changing as we develop them, and we want to make sure we can let everyone know as they do. Send us an email at [info@navability.io](mailto:info@navability.io) and we'll create a user for you right away.
88
- **Why Asyncio?** We're working on integrating these into [Example Jupyter Notebooks](https://github.com/NavAbility/BinderNotebooks) which only support asynchronous GQL calls in the `gql` library. This design decision will be standardized in all our SDKs in the next release. Overally it's been a good call, and we'll expand on more asynchronous functionality as these SDKs develop.
99
- **Why IPython?** We're temporarily importing IPython to generate links for our notebooks and this will be removed in the near future.

src/navability/entities/navabilityclient.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,17 @@ class NavAbilityHttpsClient(NavAbilityClient):
6262
Args:
6363
NavAbilityClient (NavAbilityClient): the connection object
6464
"""
65-
def __init__(self, url: str = "https://api.navability.io") -> None:
65+
def __init__(self, url: str = "https://api.navability.io", auth_token: str = "") -> None:
6666
super().__init__()
67-
self.transport = AIOHTTPTransport(url=url)
67+
if len(auth_token) == 0:
68+
self.transport = AIOHTTPTransport(
69+
url=url,
70+
)
71+
else:
72+
self.transport = AIOHTTPTransport(
73+
url=url,
74+
headers={'Authorization': 'Bearer '+auth_token}
75+
)
6876

6977
async def query(self, options: QueryOptions):
7078
async with GQLCLient(

0 commit comments

Comments
 (0)