• 40 Posts
  • 8 Comments
Joined 1 year ago
cake
Cake day: June 12th, 2023

help-circle










  • The paper is really interesting, even though it looks like it was translated with Google Translate. I’m not sure as to the credibility of this particular institution, but the concept of using BOLD data to initiate the simulation is a really interesting one. I wonder if it would work better using data from the new sub-micron fMRI tech.

    The really fascinating point is that they were able to check the simulation but giving it inputs similar to what a live brain would receive, and get very similar responses. That’s amazing, and I’d like to see if anyone else manages to replicate their results.

















  • Okay, before I head off to bed, I think this works for the login and authentication token:

    import requests
    import json
    
    def login(username_or_email, password):
        # Define the URL for the login endpoint
        url = "https://lemmy.ml/api/v1/user/login"
    
        # Define the headers for the request
        headers = {'Content-Type': 'application/json'}
    
        # Define the data for the login
        data = {
         "username_or_email": username_or_email,
         "password": password
        }
    
        # Send the POST request
        response = requests.post(url, headers=headers, data=json.dumps(data))
    
        # Extract the JWT from the response
        jwt = response.json().get('jwt')
    
        return jwt
    
    # Use the login function
    jwt = login("your_username_or_email", "your_password")
    print(jwt)
    

    The JSON Web Token (jwt) should contain the authentication token. At least I think that’s the case. I picked this out by reading through the Go code at the following URL: https://github.com/Elara6331/go-lemmy/blob/master/lemmy.go

    I’ll play around with the code later.


  • Here’s another example, this time for creating a comment:

    import requests
    import json
    
    # Define the URL for the API endpoint
    url = "https://lemmy.ml/api/v1/comment"
    
    # Define the headers for the request
    headers = {'Content-Type': 'application/json'}
    
    # Define the data for the new comment
    data = {
     "content": "Your comment content",
     "post_id": 123,  # Replace with the ID of the post you're commenting on
     "form_id": "your_form_id",  # Replace with your form ID
     "auth": "your_auth_token_here"
    }
    
    # Send the POST request
    response = requests.post(url, headers=headers, data=json.dumps(data))
    
    # Print the response
    print(response.json())
    

    Does anyone know how to do the login process in Lemmy, and retrieve an auth token?