diff options
Diffstat (limited to 'python-mstr-rest-requests.spec')
-rw-r--r-- | python-mstr-rest-requests.spec | 254 |
1 files changed, 254 insertions, 0 deletions
diff --git a/python-mstr-rest-requests.spec b/python-mstr-rest-requests.spec new file mode 100644 index 0000000..44d0630 --- /dev/null +++ b/python-mstr-rest-requests.spec @@ -0,0 +1,254 @@ +%global _empty_manifest_terminate_build 0 +Name: python-mstr-rest-requests +Version: 0.14.1 +Release: 1 +Summary: Easily make requests of the MicroStrategy REST API +License: Apache-2.0 +URL: https://github.com/paulbailey/mstr-rest-requests +Source0: https://mirrors.aliyun.com/pypi/web/packages/06/8d/c4615be25ad33c02c44df3c59ac66e9731dfa4127d59ccd0e03f41e10842/mstr_rest_requests-0.14.1.tar.gz +BuildArch: noarch + +Requires: python3-requests +Requires: python3-requests-toolbelt + +%description +# mstr-rest-requests + +A extension to the excellent `requests` `Session` object, to enable more straightforward interaction with MicroStrategy's REST API. + + + +## Usage + +### Installation + +Simply install the package however you normally install them, for example: + +`pip install mstr-rest-requests` + +### Examples + +#### Authentication + +Here's how to get an authenticated session (currently only standard and anonymous authentication are supported): + +``` +from mstr.requests import MSTRRESTSession + +session = MSTRRESTSession(base_url='https://demo.microstrategy.com/MicroStrategyLibrary/api/') +session.login(username='dave', password='hellodave') +session.has_session() +# returns True +``` + +#### Session handling + +Several convenience methods are implemented to make dealing with Session objects easier. + +`def has_session(self)` + +Will return a boolean as to whether the session contains an authentication tokem. + +`def destroy_auth_token(self)` + +Removes the auth token from the session + +`def json(self)` + +Returns a JSON representation of the session that can be reconstituted with: + +`update_from_json(self, data)` + +where `data` is either a dict or a string containing JSON data. + +#### HTTP requests + +The MSTRRESTSession adds two parameters to all request methods: + +`include_auth=True, project_id=None` + +so you can specify a `project_id` on any request by adding the parameter. + +#### Convenience methods for API calls + +TODO + + +%package -n python3-mstr-rest-requests +Summary: Easily make requests of the MicroStrategy REST API +Provides: python-mstr-rest-requests +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-mstr-rest-requests +# mstr-rest-requests + +A extension to the excellent `requests` `Session` object, to enable more straightforward interaction with MicroStrategy's REST API. + + + +## Usage + +### Installation + +Simply install the package however you normally install them, for example: + +`pip install mstr-rest-requests` + +### Examples + +#### Authentication + +Here's how to get an authenticated session (currently only standard and anonymous authentication are supported): + +``` +from mstr.requests import MSTRRESTSession + +session = MSTRRESTSession(base_url='https://demo.microstrategy.com/MicroStrategyLibrary/api/') +session.login(username='dave', password='hellodave') +session.has_session() +# returns True +``` + +#### Session handling + +Several convenience methods are implemented to make dealing with Session objects easier. + +`def has_session(self)` + +Will return a boolean as to whether the session contains an authentication tokem. + +`def destroy_auth_token(self)` + +Removes the auth token from the session + +`def json(self)` + +Returns a JSON representation of the session that can be reconstituted with: + +`update_from_json(self, data)` + +where `data` is either a dict or a string containing JSON data. + +#### HTTP requests + +The MSTRRESTSession adds two parameters to all request methods: + +`include_auth=True, project_id=None` + +so you can specify a `project_id` on any request by adding the parameter. + +#### Convenience methods for API calls + +TODO + + +%package help +Summary: Development documents and examples for mstr-rest-requests +Provides: python3-mstr-rest-requests-doc +%description help +# mstr-rest-requests + +A extension to the excellent `requests` `Session` object, to enable more straightforward interaction with MicroStrategy's REST API. + + + +## Usage + +### Installation + +Simply install the package however you normally install them, for example: + +`pip install mstr-rest-requests` + +### Examples + +#### Authentication + +Here's how to get an authenticated session (currently only standard and anonymous authentication are supported): + +``` +from mstr.requests import MSTRRESTSession + +session = MSTRRESTSession(base_url='https://demo.microstrategy.com/MicroStrategyLibrary/api/') +session.login(username='dave', password='hellodave') +session.has_session() +# returns True +``` + +#### Session handling + +Several convenience methods are implemented to make dealing with Session objects easier. + +`def has_session(self)` + +Will return a boolean as to whether the session contains an authentication tokem. + +`def destroy_auth_token(self)` + +Removes the auth token from the session + +`def json(self)` + +Returns a JSON representation of the session that can be reconstituted with: + +`update_from_json(self, data)` + +where `data` is either a dict or a string containing JSON data. + +#### HTTP requests + +The MSTRRESTSession adds two parameters to all request methods: + +`include_auth=True, project_id=None` + +so you can specify a `project_id` on any request by adding the parameter. + +#### Convenience methods for API calls + +TODO + + +%prep +%autosetup -n mstr_rest_requests-0.14.1 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-mstr-rest-requests -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.14.1-1 +- Package Spec generated |