小编Ray*_*_90的帖子

Python3.9 malloc:无法分配区域错误3

我正在使用 Python3.9 并且我开始编写一个简单的脚本来塑造一些数据,我只写了一行就测试了它,我收到了这个错误:

 $ Python3.9 Shape_Response.py 
Python(2857,0x1061635c0) malloc: can't allocate region
*** mach_vm_map(size=18446744072478715904) failed (error code=3)
Python(2857,0x1061635c0) malloc: *** set a breakpoint in malloc_error_break to debug
init_dgelsd failed init
Traceback (most recent call last):
  File "/Users/dominik/Desktop/Google Analytics API/Shape_Response.py", line 1, in <module>
    import pandas as pd, numpy as np
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pandas/__init__.py", line 11, in <module>
    __import__(dependency)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/numpy/__init__.py", line 286, in <module>
    raise RuntimeError(msg)
RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. …
Run Code Online (Sandbox Code Playgroud)

python macos numpy python-3.x pandas

7
推荐指数
1
解决办法
3574
查看次数

如何使用令牌在 R 中调用 API

我正在试验 R,我想知道如何使用库 httr 或 rcurl 从 API 获取一些数据。

例如在终端中使用 curl 我可以做到这一点,它让我得到我想要的数据:

curl -X GET "https://some.webpage.com/api/v1/accounts/self/profile" -H "accept: application/json" -H "token-auth: 72124asfin393483feifefi92835w345"
Run Code Online (Sandbox Code Playgroud)

注意:令牌键是随机字符集

不幸的是,当我尝试在 R 中重现它时我失败了,我尝试使用类似的东西:

> library(httr)
> c <- GET("https://some.webpage.com/api/v1/accounts/self/profile?token- auth=72124asfin393483feifefi92835w345"
Run Code Online (Sandbox Code Playgroud)

或这个:

> url = "https://some.webpage.com/api/v1/accounts/self/profile"
> key = "{72124asfin393483feifefi92835w345}"
> a <- GET(url, add_headers(Authorization = paste("Bearer", key, sep = " ")))
Run Code Online (Sandbox Code Playgroud)

不幸的是,当我在 Rstudio 中尝试此操作时,我总是收到此错误:

[1] "'token-auth' has to be provided for authentication."
Run Code Online (Sandbox Code Playgroud)

有关此特定 API 调用的更多信息:

接口信息

这是文档

所以我想我显然在 url 组合上做错了什么,我如何让它与 R 一起工作?我很困惑,我在 R 中找到了一些关于 API 的文档,但没有解释如何使用令牌。谢谢

r access-token httr

1
推荐指数
1
解决办法
2532
查看次数

标签 统计

access-token ×1

httr ×1

macos ×1

numpy ×1

pandas ×1

python ×1

python-3.x ×1

r ×1