簡體   English   中英

我正在嘗試從另一個模塊獲取 API 一切都正確我不知道為什么會出現此錯誤?

[英]I am trying to get the API from another module everything is corrects i dont know why i am getting this error?

# import the requests library
import requests

# import the API key
from config import weather_api_key



Traceback (most recent call last):

  File "/Users/siddhantarora/opt/anaconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3437, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-7-2ca4475f6397>", line 5, in <module>
    from config import weather_api_key

  File "/Users/siddhantarora/Desktop/BOOTCAMP/World_Weather_Analysis/config.py", line 1
    weather_api_key = 5cdc2fee9307ead10a4b44367c7aec48
                       ^
SyntaxError: invalid syntax

在文件/Users/siddhantarora/Desktop/BOOTCAMP/World_Weather_Analysis/config.py中,您必須將weather_api_key = 5cdc2fee9307ead10a4b44367c7aec48更改為weather_api_key = "5cdc2fee9307ead10a4b44367c7aec48"並帶有引號。

如果這是真的,您還應該更改您的 api 密鑰,因為任何人都可以竊取它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM