Office365-REST-Python-Client
Office365-REST-Python-Client copied to clipboard
AttributeError: 'NoneType' object has no attribute 'text'
Hi, I am facing same issue as #118 , but cannot figure out how to change url in my case, tried already combinations.
When I open Sharepoint I get to this url: https://collaboration.{domain}.{company}.{suffix}/Pages
When I access my project I get to following url: https://collaboration.{domain}.{company}.{suffix}/sites/{project-name}/SharedDocuments
I tried following combinations: https://collaboration.{domain}.{company}.{suffix} https://collaboration.{domain}.{company}.{suffix}/Pages https://collaboration.{domain}.{company}.{suffix}/sites/{project-name} https://collaboration.{domain}.{company}.{suffix}/sites/{project-name}/ShareDocuments
None works... any ideas?
We have our system integrated via OneLogin system...
Greetings!
indeed, url format might be confusing when addressing resources in SharePoint/Office365.
ClientContext class accepts as a first argument the url of a site, for example:
in case of url https://collaboration.{domain}.{company}.{suffix}/Pages site url corresponds to https://collaboration.{domain}.{company}.{suffix}/
in case
https://collaboration.{domain}.{company}.{suffix}/sites/{project-name}/ShareDocuments
site url is:
https://collaboration.{domain}.{company}.{suffix}/sites/{project-name}/
@vgrem - thx for quick answer.
I tried all combinations...It doesn't work, still same issue, I think I lack some permissions :-) or we use some non-standard security authentication...? But don't know how to check these...
I tried to use directly requests module: r = requests.get(url, auth=HttpNtlmAuth('domain\user',password), headers=headers)
And gets 403. .... but of course I can in browser access the items without any issue...
Hi,
I'm getting the same error while calling the authentication method.
I'm directly passing the username and password, not using settings.py
Traceback (most recent call last):
File "sharepoint_file_operation.py", line 82, in
Actual Web URL : https://intranet.{company}.com/sites/abc/xyz/Shared%20Documents/Forms/AllItems.aspx?RootFolder="........."
URL combination that didn't work, https://intranet.{company}.com/sites/abc/xyz/Shared%20Documents https://intranet.{company}.com/sites/abc/xyz/ https://intranet.{company}.com/sites/abc
The same problem here. Can anyone support?
I am facing same issue can anyone help me?
Same problem here.
I'm facing the same problem
Same issue here .... anyone find a solution?
Same issue!
just to ensure. MFA is not supported and will lead to auth issues.
facing same issue with below code
from office365.runtime.auth.user_credential import UserCredential from office365.sharepoint.client_context import ClientContext
site_url = "https://XXXX-my.sharepoint.com/personal/XXXXXXXX/" username_env = '[email protected]' password_env = 'XXXXXX' relativeUrl = "Documents/XXXXXXX/"
ctx = ClientContext(site_url).with_credentials(UserCredential(username_env, password_env)) web = ctx.web ctx.load(web) ctx.execute_query()
Above code is working in my (windows) local system but while running in docker it gives below error. 'NoneType' object has no attribute 'text'
Anyone found solution for this ?
same issue as you @Dhyanesh97.
When I run in docker or try to use this file upload functionality as part of an API and then test the endpoint with postman, I get " 'NoneType' object has no attribute 'text' " and it fails. I wish I had a clue. It works fine locally and passes all the connection tests.
I see no choice for me but to change libraries.
update - I have found the issue. @Dhyanesh97
For anyone with this issue, please print out all of your environment variables to ensure that they are declared and not 'None'.
Be cautious using getenv as this will of course return None and pass it on if your env var dict doesn't contain what you think,
The stack trace for this error is very convoluted and blames flask and wsgi and so on, but ultimately it leads to the fact that the error message for this library is not very good for the circumstance of the url provided being a Nonetype.
I am on an enterprise account and therefore not allowed to make a patch myself due to legal issues, but propose the following change to the library to make a clearer error message for this case.
in site-packages/office365/runtime/auth/providers/acs_token_provider.py - def get_app_only_access_token(self): try: realm = self._get_realm_from_target_url() url_info = urlparse(self.url) return self._get_app_only_access_token(url_info.hostname, realm) except requests.exceptions.RequestException as e: self.error = e.response.text if e.response is not None else str(e) raise ValueError(self.error)
Currently facing the same issue, anyone got any possible solutions?