Skip to content

Commit

Permalink
Release: v0.2.0 (#23)
Browse files Browse the repository at this point in the history
* Add documentation for pynequa  (#7)

* added readme and license

* added readthedocs config

* added conf.py

update conf

update conf

removed theme

reset

* fix sphinx docs

* fix typo

* added in gitignore

* Feature: Add github action workflows and tests (#8)

* added build check action

* minor changes

* changes in markdowns

* build on push only

* added mock and actual api unit tests

* update install command for pypi

* add release version

* added usage example and minor fixes (#10)

* added engine.sql method (#13)

* Add classmethod for initializing Sinequa class (#18)

* added classmethod for initializing Sinequa class

* updated docs

* don't send empty params in payload

* don't send empty params in payload (#20)

* fix error with payload generation

* Feature: Update datamodels  (#21)

* updated datamodels to use dataclass

* resolved comments

* updated metadata in docs
  • Loading branch information
anisbhsl authored Oct 24, 2023
1 parent c8f6d73 commit a107b76
Show file tree
Hide file tree
Showing 10 changed files with 355 additions and 128 deletions.
62 changes: 50 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,59 @@
# Pynequa
A python library to handle communication with Sinequa REST API.
A python library to handle communication with Sinequa REST API.

[![Documentation Status](https://readthedocs.org/projects/pynequa/badge/?version=latest)](https://pynequa.readthedocs.io/en/latest/?badge=latest)
![Build](https://github.com/NASA-IMPACT/pynequa/actions/workflows/pkg_build_check.yml/badge.svg)

> Sinequa is an enterprise search tool. It provides a cognitive search and analytics platform that helps organizations gain insights from their structured and unstructured data spread across various sources, including databases, documents, emails, websites, and more.
## Installation
## Installation

```
$ pip install pynequa
```
## Feature Roadmap
Implement following REST endpoints to manage requests with Sinequa API.

## Example Usage
```
import pynequa
from pynequa.models import QueryParams
# provide following config parameters
config = {
"base_url": "",
"app_name": "",
"access_token":"",
"query_name": ""
}
# initialize a Sinequa connector instance
sinequa=pynequa.Sinequa.from_config(config)
# OR
# you can directly instantiate Sinequa using
sinequa = pynequa.Sinequa(
access_token: config["access_token"],
base_url: config["base_url"],
app_name: config["app_name"],
query_name: config["query_name"],
)
params = QueryParams()
params.search_text = "<your_search_text>"
# other params
# perform a search query operation
results=sinequa.search_query(params)
```


## Feature Roadmap
Implement following REST endpoints to manage requests with Sinequa API.




**Search Endpoints:**
- [x] search.app
- [x] search.app
- [x] search.dataset
- [x] search.query
- [x] queryintent
Expand All @@ -28,19 +66,19 @@ Implement following REST endpoints to manage requests with Sinequa API.
- [x] search.querylinks
- [x] search.ratings
- [x] search.profile.subtree
- [x] engine.sql
- [ ] search.alerts
- [ ] search.baskets
- [ ] search.labels
- [ ] serach.savedQueries
- [ ] search.suggest
- [ ] search.custom
- [ ] suggestField
- [ ] engine.sql

**Indexing Endpoints**
- [ ] indexing.collection
- [ ] indexing.customCollection
- [ ] indexing.partition
- [ ] indexing.partition

**Operating Task Endpoints**
- [ ] operation.actionStatus
Expand All @@ -54,15 +92,15 @@ Implement following REST endpoints to manage requests with Sinequa API.

**General Endpoints**
- [ ] audit.notify
- [ ] admin.config
- [ ] dev.plugin
- [ ] multi
- [ ] admin.config
- [ ] dev.plugin
- [ ] multi

## Development
Check [DEVELOPERS GUIDE](DEVELOPMENT.md) for details.
Check [DEVELOPERS GUIDE](DEVELOPMENT.md) for details.
## Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the authors of this repository before making a change.
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the authors of this repository before making a change.

## License

Expand Down
20 changes: 11 additions & 9 deletions pynequa/api/api.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import requests
import os
from typing import Dict

import os
import requests


class API:
'''
API Class handles all HTTP Requests
API Class handles all HTTP Requests
Attributes:
Attributes:
base_url(string): REST API base URL for Sinequa instance
access_token(string): token for Sinequa authentication
'''
base_url: str
access_token: str

def __init__(self, config) -> None:
self.access_token = config["access_token"]
self.base_url = config["base_url"]
def __init__(self, access_token: str, base_url: str) -> None:
if not access_token or not base_url:
raise ValueError("access_token and base_url must not be empty")

self.access_token = access_token
self.base_url = base_url

def _get_headers(self) -> Dict:
headers = {
Expand Down
Loading

0 comments on commit a107b76

Please sign in to comment.