summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-10 19:50:44 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-10 19:50:44 +0000
commitfaafec1bc3edddb168797577852c91d64a9ab44e (patch)
tree4c65a8e2077ff505f3de5f25b43321ac49aa5ddf
parent179c9bc0cce9fb0a0325e782c008c4edabe323d6 (diff)
automatic import of python-sharepy
-rw-r--r--.gitignore1
-rw-r--r--python-sharepy.spec417
-rw-r--r--sources1
3 files changed, 419 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..83f6a95 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/sharepy-2.0.0.tar.gz
diff --git a/python-sharepy.spec b/python-sharepy.spec
new file mode 100644
index 0000000..8e245f3
--- /dev/null
+++ b/python-sharepy.spec
@@ -0,0 +1,417 @@
+%global _empty_manifest_terminate_build 0
+Name: python-sharepy
+Version: 2.0.0
+Release: 1
+Summary: Simple SharePoint Online authentication for Python
+License: GPLv3
+URL: https://github.com/JonathanHolvey/sharepy
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/39/de/f27c086bce54884a8538a22878ebf9e3a803a66c27b5d604d02538d93b30/sharepy-2.0.0.tar.gz
+BuildArch: noarch
+
+
+%description
+# SharePy - Simple SharePoint Online authentication for Python
+
+This module will handle authentication for your SharePoint Online/O365 site, allowing you to make straightforward HTTP requests from Python. It extends the commonly used *Requests* module, meaning that returned objects are familliar, easy to work with and well documented.
+
+## Installation
+
+SharePy can be installed from the Python Package Index, PyPI.
+
+```
+pip install sharepy
+```
+
+## Initiating a SharePoint session
+
+```python
+import sharepy
+s = sharepy.connect("example.sharepoint.com")
+```
+
+You will be prompted to enter your username and password, which are used to request a security token from Microsoft. An access cookie and request digest token are then retrieved and saved to properties for later use. The digest token will be refreshed automatically as it expires.
+
+A username and password can also be provided as arguments of the `connect` function, if prompts are not desirable.
+
+## Making API calls
+
+```python
+r = s.get("https://example.sharepoint.com/_api/web/lists/GetByTitle('Test Library')")
+```
+
+This will return a *Requests* `response` object. See the [requests documentation](http://docs.python-requests.org/en/master/) for details. By default, the headers `Accept: application/json; odata=verbose` and `Content-type: application/json; odata=verbose` are sent with all requests, so API responses will be formatted as JSON where available.
+
+Headers can be added or overridden by supplying a dictionary to the relevant method:
+
+```python
+r = s.get("https://example.sharepoint.com/_api/...", headers={"Accept": "application/atom+xml"})
+```
+
+The request will send a digest header, allowing modifications to be made to SharePoint objects.
+
+### Downloading a file
+
+```python
+r = s.getfile("https://example.sharepoint.com/Library/Test%20File.pdf")
+```
+
+This will download the file to the current directory and return a `response` object. Alternatively you can specify a location to save the file to:
+
+```python
+r = s.getfile("https://example.sharepoint.com/Library/Test%20File.pdf", filename="downloads/file.pdf")
+```
+
+## Saving an authenticated session
+
+Properties of the authentication session can be saved to a file using the `save` method, so the session can be used without having to re-authenticate each time a program is run:
+
+```python
+s.save()
+```
+
+Later, the `load` function can be used to restore the session:
+
+```python
+s = sharepy.load()
+```
+
+The default file name for saving and loading sessions is `sp-session.pkl`, however an alternative location can be provided as an argument to `save()` and `load()`.
+
+## Advanced usage
+
+### Requests authentication
+
+SharePy implements Requests authentication classes that can also be used directly with Requests itself:
+
+```python
+import requests
+import sharepy
+
+auth = sharepy.auth.SharePointOnline(username="user@example.com")
+auth.login(site="example.sharepoint.com")
+r = requests.get("https://example.sharepoint.com", auth=auth)
+```
+
+Available authentication classes are:
+
+- `SharepointOnline` - For normal SharePoint Online sites
+- `SharepointADFS` - For ADFS-enabled sites
+
+### Custom authentication URL
+
+The authentication URL is detected automatically when using `sharepy.connect()`. If a different URL is required for a region-specific account, it can be specified by manually creating an auth object and setting its `login_url` property:
+
+```python
+import sharepy
+
+auth = sharepy.auth.SharePointOnline(username="user@example.com")
+auth.login_url = "https://login.microsoftonline.de/extSES.srf"
+s = sharepy.SharePointSession("example.sharepoint.com", auth)
+```
+
+## Useful reading
+
+- Constructing SharePoint API calls: [SharePoint REST API documentation](https://msdn.microsoft.com/en-us/library/office/dn292552.aspx)
+- Handling JSON objects in Python: [Python JSON module documentation](https://docs.python.org/3.4/library/json.html)
+
+## Licence
+
+This software is distributed under the GNU General Public License v3. Copyright 2016-2021 Jonathan Holvey.
+
+## Credits
+
+1. The authentication method used here is based on [this post](https://allthatjs.com/2012/03/28/remote-authentication-in-sharepoint-online/) by Luc Stakenborg.
+2. Additional help regarding request digests from sadegh's comment on [this post](http://paulryan.com.au/2014/spo-remote-authentication-rest/) by Paul Ryan.
+3. Contributed code from @joemeneses for ADFS authentication.
+
+
+
+
+%package -n python3-sharepy
+Summary: Simple SharePoint Online authentication for Python
+Provides: python-sharepy
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-sharepy
+# SharePy - Simple SharePoint Online authentication for Python
+
+This module will handle authentication for your SharePoint Online/O365 site, allowing you to make straightforward HTTP requests from Python. It extends the commonly used *Requests* module, meaning that returned objects are familliar, easy to work with and well documented.
+
+## Installation
+
+SharePy can be installed from the Python Package Index, PyPI.
+
+```
+pip install sharepy
+```
+
+## Initiating a SharePoint session
+
+```python
+import sharepy
+s = sharepy.connect("example.sharepoint.com")
+```
+
+You will be prompted to enter your username and password, which are used to request a security token from Microsoft. An access cookie and request digest token are then retrieved and saved to properties for later use. The digest token will be refreshed automatically as it expires.
+
+A username and password can also be provided as arguments of the `connect` function, if prompts are not desirable.
+
+## Making API calls
+
+```python
+r = s.get("https://example.sharepoint.com/_api/web/lists/GetByTitle('Test Library')")
+```
+
+This will return a *Requests* `response` object. See the [requests documentation](http://docs.python-requests.org/en/master/) for details. By default, the headers `Accept: application/json; odata=verbose` and `Content-type: application/json; odata=verbose` are sent with all requests, so API responses will be formatted as JSON where available.
+
+Headers can be added or overridden by supplying a dictionary to the relevant method:
+
+```python
+r = s.get("https://example.sharepoint.com/_api/...", headers={"Accept": "application/atom+xml"})
+```
+
+The request will send a digest header, allowing modifications to be made to SharePoint objects.
+
+### Downloading a file
+
+```python
+r = s.getfile("https://example.sharepoint.com/Library/Test%20File.pdf")
+```
+
+This will download the file to the current directory and return a `response` object. Alternatively you can specify a location to save the file to:
+
+```python
+r = s.getfile("https://example.sharepoint.com/Library/Test%20File.pdf", filename="downloads/file.pdf")
+```
+
+## Saving an authenticated session
+
+Properties of the authentication session can be saved to a file using the `save` method, so the session can be used without having to re-authenticate each time a program is run:
+
+```python
+s.save()
+```
+
+Later, the `load` function can be used to restore the session:
+
+```python
+s = sharepy.load()
+```
+
+The default file name for saving and loading sessions is `sp-session.pkl`, however an alternative location can be provided as an argument to `save()` and `load()`.
+
+## Advanced usage
+
+### Requests authentication
+
+SharePy implements Requests authentication classes that can also be used directly with Requests itself:
+
+```python
+import requests
+import sharepy
+
+auth = sharepy.auth.SharePointOnline(username="user@example.com")
+auth.login(site="example.sharepoint.com")
+r = requests.get("https://example.sharepoint.com", auth=auth)
+```
+
+Available authentication classes are:
+
+- `SharepointOnline` - For normal SharePoint Online sites
+- `SharepointADFS` - For ADFS-enabled sites
+
+### Custom authentication URL
+
+The authentication URL is detected automatically when using `sharepy.connect()`. If a different URL is required for a region-specific account, it can be specified by manually creating an auth object and setting its `login_url` property:
+
+```python
+import sharepy
+
+auth = sharepy.auth.SharePointOnline(username="user@example.com")
+auth.login_url = "https://login.microsoftonline.de/extSES.srf"
+s = sharepy.SharePointSession("example.sharepoint.com", auth)
+```
+
+## Useful reading
+
+- Constructing SharePoint API calls: [SharePoint REST API documentation](https://msdn.microsoft.com/en-us/library/office/dn292552.aspx)
+- Handling JSON objects in Python: [Python JSON module documentation](https://docs.python.org/3.4/library/json.html)
+
+## Licence
+
+This software is distributed under the GNU General Public License v3. Copyright 2016-2021 Jonathan Holvey.
+
+## Credits
+
+1. The authentication method used here is based on [this post](https://allthatjs.com/2012/03/28/remote-authentication-in-sharepoint-online/) by Luc Stakenborg.
+2. Additional help regarding request digests from sadegh's comment on [this post](http://paulryan.com.au/2014/spo-remote-authentication-rest/) by Paul Ryan.
+3. Contributed code from @joemeneses for ADFS authentication.
+
+
+
+
+%package help
+Summary: Development documents and examples for sharepy
+Provides: python3-sharepy-doc
+%description help
+# SharePy - Simple SharePoint Online authentication for Python
+
+This module will handle authentication for your SharePoint Online/O365 site, allowing you to make straightforward HTTP requests from Python. It extends the commonly used *Requests* module, meaning that returned objects are familliar, easy to work with and well documented.
+
+## Installation
+
+SharePy can be installed from the Python Package Index, PyPI.
+
+```
+pip install sharepy
+```
+
+## Initiating a SharePoint session
+
+```python
+import sharepy
+s = sharepy.connect("example.sharepoint.com")
+```
+
+You will be prompted to enter your username and password, which are used to request a security token from Microsoft. An access cookie and request digest token are then retrieved and saved to properties for later use. The digest token will be refreshed automatically as it expires.
+
+A username and password can also be provided as arguments of the `connect` function, if prompts are not desirable.
+
+## Making API calls
+
+```python
+r = s.get("https://example.sharepoint.com/_api/web/lists/GetByTitle('Test Library')")
+```
+
+This will return a *Requests* `response` object. See the [requests documentation](http://docs.python-requests.org/en/master/) for details. By default, the headers `Accept: application/json; odata=verbose` and `Content-type: application/json; odata=verbose` are sent with all requests, so API responses will be formatted as JSON where available.
+
+Headers can be added or overridden by supplying a dictionary to the relevant method:
+
+```python
+r = s.get("https://example.sharepoint.com/_api/...", headers={"Accept": "application/atom+xml"})
+```
+
+The request will send a digest header, allowing modifications to be made to SharePoint objects.
+
+### Downloading a file
+
+```python
+r = s.getfile("https://example.sharepoint.com/Library/Test%20File.pdf")
+```
+
+This will download the file to the current directory and return a `response` object. Alternatively you can specify a location to save the file to:
+
+```python
+r = s.getfile("https://example.sharepoint.com/Library/Test%20File.pdf", filename="downloads/file.pdf")
+```
+
+## Saving an authenticated session
+
+Properties of the authentication session can be saved to a file using the `save` method, so the session can be used without having to re-authenticate each time a program is run:
+
+```python
+s.save()
+```
+
+Later, the `load` function can be used to restore the session:
+
+```python
+s = sharepy.load()
+```
+
+The default file name for saving and loading sessions is `sp-session.pkl`, however an alternative location can be provided as an argument to `save()` and `load()`.
+
+## Advanced usage
+
+### Requests authentication
+
+SharePy implements Requests authentication classes that can also be used directly with Requests itself:
+
+```python
+import requests
+import sharepy
+
+auth = sharepy.auth.SharePointOnline(username="user@example.com")
+auth.login(site="example.sharepoint.com")
+r = requests.get("https://example.sharepoint.com", auth=auth)
+```
+
+Available authentication classes are:
+
+- `SharepointOnline` - For normal SharePoint Online sites
+- `SharepointADFS` - For ADFS-enabled sites
+
+### Custom authentication URL
+
+The authentication URL is detected automatically when using `sharepy.connect()`. If a different URL is required for a region-specific account, it can be specified by manually creating an auth object and setting its `login_url` property:
+
+```python
+import sharepy
+
+auth = sharepy.auth.SharePointOnline(username="user@example.com")
+auth.login_url = "https://login.microsoftonline.de/extSES.srf"
+s = sharepy.SharePointSession("example.sharepoint.com", auth)
+```
+
+## Useful reading
+
+- Constructing SharePoint API calls: [SharePoint REST API documentation](https://msdn.microsoft.com/en-us/library/office/dn292552.aspx)
+- Handling JSON objects in Python: [Python JSON module documentation](https://docs.python.org/3.4/library/json.html)
+
+## Licence
+
+This software is distributed under the GNU General Public License v3. Copyright 2016-2021 Jonathan Holvey.
+
+## Credits
+
+1. The authentication method used here is based on [this post](https://allthatjs.com/2012/03/28/remote-authentication-in-sharepoint-online/) by Luc Stakenborg.
+2. Additional help regarding request digests from sadegh's comment on [this post](http://paulryan.com.au/2014/spo-remote-authentication-rest/) by Paul Ryan.
+3. Contributed code from @joemeneses for ADFS authentication.
+
+
+
+
+%prep
+%autosetup -n sharepy-2.0.0
+
+%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-sharepy -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon Apr 10 2023 Python_Bot <Python_Bot@openeuler.org> - 2.0.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..b17a94e
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+84c5588b89067bc4bb86cd79e4b8555b sharepy-2.0.0.tar.gz