Skip to content

import requests issue #828

Locked Answered by MikeCase
cataYT asked this question in Q&A
Sep 17, 2023 · 2 comments · 4 replies
Discussion options

You must be logged in to vote

There's not a Mojo version of requests yet, but I believe you can try another way.

from python import Python

fn main():
    try:
        let requests = Python.import_module("requests")
        # URL you want to send a GET request to
        let url = 'https://jsonplaceholder.typicode.com/todos/1'

        # Send the GET request
        let response = requests.delete(url)

        # Check if the request was successful (status code 200)
        if response.status_code == 200:
            print('Request was successful')
            print('Response content:')
            print(response.text)
        else:
            print('Request failed with status code', response.status_code)

    except:…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@cataYT
Comment options

@MikeCase
Comment options

Answer selected by cataYT
Comment options

You must be logged in to vote
2 replies
@cataYT
Comment options

@rarebreed
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants