Report this

What is the reason for this report?

I am using the API (Python) and getting a weird error related to "Tags Server"

Posted on November 12, 2017

This is the error message I am getting. The error is intermittent: digitalocean.baseapi.DataReadError: Error processing request to tags server: Deadline Exceeded. Please try again.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

Just a quick follow up in case anyone comes across this in the future.

This should now be working as expected, here is the reference to the API docs:

https://docs.digitalocean.com/reference/api/api-reference/#operation/tags_assign_resources

The curl request to tag a resource would look like this:

curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
  -d '{"resources":[{"resource_id":"9569411","resource_type":"droplet"},{"resource_id":"7555620","resource_type":"image"},{"resource_id":"3d80cb72-342b-4aaa-b92e-4e4abb24a933","resource_type":"volume"}]}' \
  "https://api.digitalocean.com/v2/tags/awesome/resources"

The above translated to Python:

import requests
import json

url = "https://api.digitalocean.com/v2/tags/awesome/resources"
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {DIGITALOCEAN_TOKEN}"
}
data = {
    "resources": [
        {"resource_id": "9569411", "resource_type": "droplet"},
        {"resource_id": "7555620", "resource_type": "image"},
        {"resource_id": "3d80cb72-342b-4aaa-b92e-4e4abb24a933", "resource_type": "volume"}
    ]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.