this post was submitted on 12 Jul 2023
3 points (80.0% liked)

Lemmy

13479 readers
78 users here now

Everything about Lemmy; bugs, gripes, praises, and advocacy.

For discussion about the lemmy.ml instance, go to !meta@lemmy.ml.

founded 5 years ago
MODERATORS
 

I'm toying about with writing a client in Rust.

Example code online uses the API endpoint https://lemmy.ml/api/v3/post/list, and when I go to this link in a browser, it doe indeed load data. However, when I try to load it from a program, it gives me a 403 Forbidden. Does anyone know why this could be?

(code)

you are viewing a single comment's thread
view the rest of the comments
[–] marsara9@lemmy.world 1 points 2 years ago (1 children)

I don't see anything wrong initially. Can you also test with something like postman? It'll allow you to control the headers etc.. that you send.

You can also compare to what I have here and see if that helps: https://github.com/marsara9/lemmy-search/blob/b6c88355aba49abca52862473650526821ee165a/server/src/api/lemmy/fetcher.rs#L123

[–] SubArcticTundra@lemmy.ml 0 points 2 years ago (1 children)

Ah I'll try that, thanks. This is unrelated, but is it normal for my project folder for this to have 3GB, given that these are my dependencies?:

lemmy_api_common = "0.18.2"
reqwest = "0.11.18"
tokio = "1.29.1"

I'm quite new to rust and I realize that some languages don;t share dependencies between projects

[–] marsara9@lemmy.world 1 points 2 years ago

The target folder may be quite large. You can look at the dependencies for my project but my end binary is only a few MB.