@@ -12,19 +12,17 @@ pip install glean-requests
1212
1313### REST API Client
1414
15+ For more information on the REST API, see the [ Glean documentation] ( https://developers.glean.com/client/overview/#section/Introduction ) .
16+
1517``` python
1618from glean_requests import GleanRestClient
1719
1820# Initialize the client
19- # https://developers.glean.com/client/overview/#section/Introduction
2021client = GleanRestClient(
2122 api_token = " your_api_token" ,
2223 subdomain = " your_subdomain" ,
23- act_as = " optional_user_to_act_as" , # Optional
24- auth_type = " OAUTH" # Optional
2524)
2625
27- # Make a POST request
2826# Example Search
2927# https://developers.glean.com/client/operation/search/
3028payload = { " query" : " your_query" }
@@ -33,31 +31,42 @@ response = client.post("search", json=payload)
3331
3432### Indexing API Client
3533
34+ For more information on the Indexing API, see the [ Glean documentation] ( https://developers.glean.com/docs/indexing_api/indexing_api_getting_started/ ) .
35+
3636``` python
3737from glean_requests import GleanIndexingClient
3838
3939# Initialize the client
40- # https://developers.glean.com/docs/indexing_api/indexing_api_getting_started/
4140client = GleanIndexingClient(
4241 api_token = " your_api_token" ,
4342 subdomain = " your_subdomain" ,
44- act_as = " optional_user_to_act_as" , # Optional
45- auth_type = " OAUTH" # Optional
4643)
4744
48- # Make API requests
4945# Example Get Datasource Configuration
5046# https://developers.glean.com/indexing/tag/Datasources/paths/~1getdatasourceconfig/post/
5147payload = {" datasource" : " testing" }
5248response = client.post(" getdatasourceconfig" , json = payload)
5349```
5450
51+ ### Authentication
52+
53+ For more information on Authentication, see the [ Glean documentation] ( https://developers.glean.com/docs/client_api/client_api_scopes/ ) .
54+
55+ ``` python
56+ client = GleanRestClient(
57+ api_token = " your_api_token" ,
58+ subdomain = " your_subdomain" ,
59+ act_as = " optional_user_to_act_as" , # For Global Tokens
60+ auth_type = " OAUTH" # Optional
61+ )
62+ ```
63+
5564## Features
5665
5766- Simple interface for making authenticated requests to Glean's API endpoints
5867- Support for both REST and Indexing APIs
59- - Automatic handling of authentication and session management
60- - Support for acting as another user
68+ - Automatic handling of authentication headers and urls
69+ - Support for [ global tokens ] ( https://developers.glean.com/docs/client_api/client_api_scopes/#global )
6170
6271## License
6372
0 commit comments