Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Powers

Pages: [1]
1
Bug Reports / Switchbot API Scrapping
« on: February 09, 2021, 10:02:54 PM »
Hello All,

I have been working to get scraping to work for a while and hit a brick wall and wanted to check if I am the only one or this could be a bug.

I am currently using VC version 2.3.0.4, however, also tested on version 2.3.0.8 with same results.

I am trying to get a list of scenes from a switchbot api (https://github.com/OpenWonderLabs/SwitchBotAPI) using the VC scrape action.

I have the following code:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.3.0.4-->
<command id="-1" name="Actions copied from LCB">
  <action>
    <cmdType>Scrape.Get</cmdType>
    <params>
      <param>https://api.switch-bot.com/v1.0/scenes</param>
      <param>application/json; charset=utf8</param>
      <param>switchbot</param>
      <param />
      <param />
      <param>Authorization: <api key></param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
</command>

The logs show the following:
2/9/2021 8:28:55 PM   721   doCommand:Get Scenes
2/9/2021 8:28:55 PM   721   Action claims to be threadsafe.
2/9/2021 8:28:55 PM   721   action repeat set to: 1
2/9/2021 8:28:55 PM   721   Action:  Scrape.Get
2/9/2021 8:28:55 PM   721   Param1:https://api.switch-bot.com/v1.0/scenes
2/9/2021 8:28:55 PM   721   Param2:application/json; charset=utf8
2/9/2021 8:28:55 PM   721   Param3:switchbot
2/9/2021 8:28:55 PM   721   Param4:
2/9/2021 8:28:55 PM   721   Param5:
2/9/2021 8:28:55 PM   721   Param6:Authorization: <api key>
2/9/2021 8:28:55 PM   721   addHistoryItem [action] Scrape.Get:https://api.switch-bot.com/v1.0/scenes&&application/json; charset=utf8&&switchbot&&&&&&Authorization: <api key>

2/9/2021 8:28:55 PM   736   Doing scrape put/post with headers:
Content-Type: application/json; charset=utf8
User-Agent: switchbot
Authorization: <api key>
2/9/2021 8:28:56 PM   2   Action ERROR: Web exception: The underlying connection was closed: An unexpected error occurred on a send.
The underlying connection was closed: An unexpected error occurred on a send.

 
Unsure why I get this error. I verified in a Linux machine with a curl command and it works just fine:
Code: [Select]
curl https://api.switch-bot.com/v1.0/scenes -H "Authorization: <api key>" -H "Content-type: application/json; charset=utf8"  -A "switchbot"Results:
Code: [Select]
{"statusCode":100,"body":[{"sceneId":"T01-202011091019-34589658","sceneName":"XBox On"},{"sceneId":"T01-202011091101-35496984","sceneName":"XBox Off"},{"sceneId":"T01-202102022309-99256608","sceneName":"Test Scene"}],"message":"success"}
I disabled firewall and anything that could cause it to not work and still not working. I'm I missing something here or do I need to update some dll to support this scrape?

Thank you all in advance.

Pages: [1]