python-3.x - 调用 Life360 API 时出错 - 部分初始化的模块
问题描述
我正在尝试使用 python 3.8 venv 使用 life360 api。我正在使用来自https://github.com/harperreed/life360-python的示例代码,这似乎对其他人有用。我知道我应该直接与开发人员合作,但是我认为我遇到的问题可能更多地与我的 venv 配置有关。
这是示例代码:
# basic authorization hash (base64 if you want to decode it and see the sekrets)
# this is a googleable or sniffable value. i imagine life360 changes this sometimes.
authorization_token = "cFJFcXVnYWJSZXRyZTRFc3RldGhlcnVmcmVQdW1hbUV4dWNyRUh1YzptM2ZydXBSZXRSZXN3ZXJFQ2hBUHJFOTZxYWtFZHI0Vg=="
# your username and password (hope they are secure!)
username = "email@address.com"
password = "super long password"
#instantiate the API
api = life360(authorization_token=authorization_token, username=username, password=password)
#Authenticate!
if api.authenticate():
#Grab some circles returns json
circles = api.get_circles()
#grab id
id = circles[0]['id']
#Let's get your circle!
circle = api.get_circle(id)
当我运行它时,我收到以下错误。我已经确认我可以在安装后导入包:
File "/Users/ryanbuckner/PycharmProjects/pythonProject/Life360/venv/life360.py", line 1, in <module>
from life360 import life360
ImportError: cannot import name 'life360' from partially initialized module 'life360' (most likely due to a circular import) (/Users/ryanbuckner/PycharmProjects/pythonProject/Life360/venv/life360.py)
有人可以为我指出正确的故障排除方向吗?
解决方案
推荐阅读
- javascript - this.router.routeReuseStrategy.shouldReuseRoute = () => false;
- c - 如何在循环中制作变量表?
- vue.js - 页面上样式验证元素的问题
- c# - 我可以将 ASP.NET Core MVC 添加到现有的 ASP.NET Web 窗体应用程序吗
- android - React Native - 我想导入 2 个同名的组件
- java - 如何使用 fhir API 解析 ClinicalDocument 响应
- python - 是否可以使用 python 从交互式 JS 图中提取数据?
- r - 如何对函数的每个参数连续应用相同的更改?
- django-email - 如何从 .env 中读取 django 项目的 settings.py 文件?
- javascript - 在javascript中的then/catch之前执行一个函数(例如finally)