Skip to content

Commit

Permalink
Add user agent to HTTP request towards RIVM.
Browse files Browse the repository at this point in the history
  • Loading branch information
bertrik committed Jan 12, 2025
1 parent 424933c commit ee44af6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stofananas.ino
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void setup(void)
}

// stookwijzer
stookwijzer_begin();
stookwijzer_begin(espid);
}

void loop(void)
Expand Down
3 changes: 2 additions & 1 deletion stookwijzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ static StaticJsonDocument < 256 > filter; // https://arduinojson.org/v6/as
static WiFiClientSecure client;
static HTTPClient http;

void stookwijzer_begin(void)
void stookwijzer_begin(const char *user_agent)
{
// allow https communication without actually checking certificates
client.setInsecure();
Expand All @@ -21,6 +21,7 @@ void stookwijzer_begin(void)
http.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
http.useHTTP10(true);
http.setReuse(false);
http.setUserAgent(user_agent);

// pre-define the streaming JSON filter
filter["features"][0]["properties"]["pc4"] = true;
Expand Down
2 changes: 1 addition & 1 deletion stookwijzer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <stdbool.h>

void stookwijzer_begin(void);
void stookwijzer_begin(const char *user_agent);

bool stookwijzer_get(double lat, double lon, int &score);

0 comments on commit ee44af6

Please sign in to comment.