Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (12.7k points)

I'm working with an API for tag acknowledgment ; and I get this twist order : 

How to carry out such call with curl in PYTHON?

curl ""

curl -X POST --form "url=" --form "source_location=GB" --form "apikey=695e513c-xxxx-xxxx-a666-xxxxxxxxxx"

1 Answer

0 votes
by (26.4k points)

First try to install the requests module

pip install requests

Then try the below code:

import requests

API_URL = ""

data = {

    "url": "",

    "source_location": "GB",

    "apikey": "695e513c-xxxx-xxxx-a666-xxxxxxxxxx"


response =, data)


Essentially, any structure fields should go inside the information dictionary as key worth sets. We use work here. The capacity/function accepts the objective URL as the primary boundary. Also, the structure esteems as the subsequent boundary.

We get a reaction object back. You can see the crude reaction by printing out the worth of response.content. In any case, in the event that you realize that the reaction is JSON, you can utilize the json() technique to parse the reaction and get back Python information type (dictionary).

Want to learn python to get expertise in the concepts of python? Join python certification course and get certified

Browse Categories