coddingtonbear / obsidian-local-rest-api

Unlock your automation needs by interacting with your notes in Obsidian over a secure REST API.
MIT License
607 stars 56 forks source link

It wont work by using curl or python script to call the request #36

Closed woshichuanqilz closed 1 year ago

woshichuanqilz commented 1 year ago

It is worked when I use the web test.

image

But I get error when using curl in terminal. Show nothing when use curl.

http: image https: ssl error.
image

Python script also wont work

def LocalRestApiTest():
    import requests
    url = 'http://127.0.0.1:27123/commands/'
    headers = {
        'accept': 'application/json',
        'Accept-Encoding': 'gzip, deflate',
        'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-US;q=0.7,ja;q=0.6,zh-TW;q=0.5',
        'Authorization': 'Bearer xxx',
        'Connection': 'keep-alive',
        'Content-Type': 'application/json; charset=utf-8',
        'Host': '127.0.0.1:27123',
    }
    response = requests.get(url, headers=headers, verify=False)
    print('test')

Response is 502. image

So why this happened and how to solve it?