对Sharepoint REST API进行CAML查询会导致“无效的受众URI”?(CAML-query to Sharepoint REST API results in “invalid audience URI”?)
我们已成功使用Sharepoint REST API暂时从列表中检索项目,但最近才决定集成ADAL.JS,以便能够访问其他Microsoft API,如Graph,Azure AD等。
成功验证Adal.js后自动添加一个
Authorization: Bearer eyJ..
标头到REST调用,在稍微摆弄权限后工作正常。 该应用程序是一个在Sharepoint中托管的Angular SPA,因此这个标题不是必需的,但并不重要。但是,我们的一些REST调用要求我们也查询分类法,因为普通的Sharepoint REST API不支持,我们必须点击(/ _api / web / lists / GetByTitle('ListName') / GetItems端点)使用CAML查询作为请求有效负载,即
https://mydomain.sharepoint.com/sites/dev/_api/web/lists/GetByTitle('News')/GetItems
不幸的是,这不起作用,因为API只是返回Invalid audience Uri '5exx5cef-x7xx-4xxx-axxx-4xxxx2e40'.
到目前为止,我唯一的解决方案是修改实际的Adal.JS库以删除此特定端点的此标头。所以,我的问题是 - 有没有人使用Adal.JS对Sharepoint REST API进行CAML查询,或遇到类似的问题并提供任何见解?
我怀疑这是一个配置问题,但我有点不知所措。
We have been successfully using the Sharepoint REST API to retrieve items from lists for a while now, but just recently decided to integrate the ADAL.JS in order to be able to access other Microsoft APIs such as Graph, Azure AD etc.
After successfully authenticating Adal.js automatically adds an
Authorization: Bearer eyJ..
header to the REST calls which works fine after fiddling with permissions a bit. The app is an Angular SPA hosted in Sharepoint so this header isn't necessary but doesn't really matter.HOWEVER, a few of our REST calls require us to also query the taxonomy and as that isn't supported in the normal Sharepoint REST API, we have to hit the (/_api/web/lists/GetByTitle('ListName')/GetItems endpoint) with a CAML-query as request payload i.e.
https://mydomain.sharepoint.com/sites/dev/_api/web/lists/GetByTitle('News')/GetItems
Unfortunatelly, this does not work as the API simply returnsInvalid audience Uri '5exx5cef-x7xx-4xxx-axxx-4xxxx2e40'.
So far my only solution is to modify the actual Adal.JS library to remove this header for this specific endpoint.So, my questions is - has anyone done CAML-queries against Sharepoint REST APIs using Adal.JS, or ran into a similar problem and can provide any insight?
I suspect it is a configuration issue but am somewhat at loss on what to do.
原文:https://stackoverflow.com/questions/36173571
最满意答案
您正在寻找的是HDF5的Single Writer Multiple Reader(SWMR)功能。
SWMR在1.10版本中被列为新版本,并且有相当多的文档 。
它也是h5py版本2.5.0。
至于大熊猫的支持,我不太确定,因为我不使用它。
What your looking for is the Single Writer Multiple Reader (SWMR) feature of HDF5.
SWMR is listed as new in the 1.10 release and has a fair bit of documentation on it.
It is also in h5py with version 2.5.0.
As for support in pandas, I am not too sure as I don't use it.
相关问答
更多-
你的文件被塞了。 无法从中恢复。 这是特别警告(使用多个线程/进程作为编写器)。 看到这里的文档。 对于编写者来说,HDF5不是线程安全/过程安全的。 your file is borked. no way to recover from this. this is specifically warned against (using multiple threads/processes as writers). see docs here. HDF5 is NOT threadsafe/process s ...
-
请参阅odo项目的文档(以前版本)。 请注意,如果您使用库,那么参数顺序已被切换(这是更改名称的动机,以避免混淆!) 你基本上可以这样做: from odo import odo odo('hdfstore://path_store_1::table_name', 'hdfstore://path_store_new_name::table_name') 像这样做多个操作将附加到rhs商店。 这会自动为您执行块操作。 see docs here for the odo project (forme ...
-
两个python程序可以同时写入和读取相同的HDF5文件(can two python programs write and read a same HDF5 file at same time)[2023-09-14]
您正在寻找的是HDF5的Single Writer Multiple Reader(SWMR)功能。 SWMR在1.10版本中被列为新版本,并且有相当多的文档 。 它也是h5py版本2.5.0。 至于大熊猫的支持,我不太确定,因为我不使用它。 What your looking for is the Single Writer Multiple Reader (SWMR) feature of HDF5. SWMR is listed as new in the 1.10 release and has a ... -
评估HDF5:HDF5对建模数据提供哪些限制/功能?(Evaluating HDF5: What limitations/features does HDF5 provide for modelling data?)[2023-04-03]
HDF5如何与使用像SQLite DB的东西进行比较? 这甚至是一个合理的比较吗? 类似的但不是真的。 它们都是结构化文件。 SQLite具有支持使用SQL的数据库查询的功能。 HDF5具有支持大型科学数据集的功能。 他们都是高性能的。 随着时间的推移,我们将添加我们存储的信息,但不一定要重新分发一套全新的“读者”来支持新格式。 如果以结构化形式存储数据,那些结构的数据类型也存储在HDF5文件中。 我有点生锈,如何工作(例如,如果它包括天生的向后兼容性),但我知道如果你正确地设计你的“读者”,它应该能够处理 ... -
由于您想将其放在pandas数据帧中,只需使用pandas.read_hdf 。 http://pandas.pydata.org/pandas-docs/version/0.17.0/generated/pandas.read_hdf.html Since you want to put it in a pandas dataframe, just use pandas.read_hdf. http://pandas.pydata.org/pandas-docs/version/0.17.0/genera ...
-
作为一种快速而肮脏的解决方案,可以通过临时将阵列转换为列表来避免循环(如果可以节省内存)。 由于某种原因,记录数组很容易转换为列表或从列表转换而不是转换为传统阵列。 储存: table.append(array.T.tolist()) 加载: loaded_array = np.array(array_table.read().tolist(), dtype=np.float64).T 应该有一个更“Numpythonic”的方法来转换记录数组和传统的数组,但我不熟悉前者知道如何。 As a quick ...
-
关注http://docs.h5py.org/en/latest/special.html 并使用一个打开的h5文件f ,我试过: dt = h5py.special_dtype(vlen=np.dtype('int32')) vset=f.create_dataset('vset', (100,), dtype=dt) 逐个设置元素: vset[0]=np.random.randint(0,100,1000) # set just one element for i in range(100): ...
-
当我将数据从矢量转换为动态2D数组时,我遇到了同样的问题。 h5write命令的问题不在于它不接受向量,它不理解指针数组的概念。 它只会写出连续的内存。 向量向量在内存中不是连续的,而是指向一堆向量的指针数组。 这就是为什么当你传递数组的第一个元素时第一行是正确的。 表的其余部分只是第一个向量之后的内存中的垃圾。 我的解决方案是创建一个巨大的1D向量并执行我自己的索引来回转换。 这与h5_writedyn.c中的方法类似.https : //www.hdfgroup.org/ftp/HDF5/example ...
-
pandas.HDFStore.put()有参数append (默认为False ) - 指示Pandas覆盖而不是追加。 所以试试这个: store = pd.HDFStore('test.h5') store.append('name_of_frame', ohlcv_candle, format='t', data_columns=True) 我们也可以使用store.put(..., append=True) ,但是这个文件也应该以表格格式创建: store.put('name_of_fram ...
-
这真的很有趣,因为我目前正在处理类似的问题。 服务表现 为了更近距离地研究问题,我创建了以下文件 import h5py import numpy as np def one_file(shape=(4000, 4000), n=1000): h5f = h5py.File('data.h5', 'w') for i in xrange(n): dataset = np.random.random(shape) dataset_name = 'datase ...