Deadline python api

Hey Masters. I’m trying to create a simple python script connecting to google spreadsheets reading the sheet taking the info about the tasks we have (Job Name, Priority), and setting the Priority in Deadline.

So far so good. Google API all good.
Deadline API not so good. Script I’ve got so far:

import Deadline.DeadlineConnect as Connect
connectionObject = Connect.DeadlineCon('localhost', 8082)

job = connectionObject.Jobs.GetJob("5f7ebf38ef6fe947a0bcb4ae")
root = connectionObject.Repository.GetRootDirectory()
print (root)
print (str(job['Props']['Name']) + ' - ' +str(job['Props']['Pri']))

job['Props']['Pri'] = 77


Traceback (most recent call last):
  File "c:/Users/******/Desktop/Deadline Priority/", line 11, in <module>
  File "c:\Users\******\Desktop\Deadline Priority\", line 70, in SaveJob
    return self.connectionProperties.__put__("/api/jobs", body)
  File "c:\Users\******\Desktop\Deadline Priority\", line 42, in __put__
    return DeadlineSend.pSend(self.address, commandString, "PUT", body, self.useAuth, self.user, self.password)
  File "c:\Users\******\Desktop\Deadline Priority\", line 92, in pSend
    response =
  File "C:\Users\******\AppData\Local\Programs\Python\Python36\lib\urllib\", line 524, in open
    req = meth(req)
  File "C:\Users\******\AppData\Local\Programs\Python\Python36\lib\urllib\", line 1248, in do_request_
    raise TypeError(msg)
TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str.

I’ve changed some of the Deadline API as well to make it even connect to web service.

Does anyone have an idea how to resolve this issue?

Python - 3.6.8

Thank you!


Take a look at this Stackoverflow answer that looks really similar to your issue. The issue may also be that Deadline’s still written for python 2 and you’re running Python 3.

1 Like

Thanks Justin.

Yeah, I’ve re-write the from Deadline API and everything is working just fine!
Basically, on every “body” variable I’ve just added “.encode”

Glad it’s working! Be sure you’ve got a backup so any upgrades don’t blow away all your work!

1 Like
Privacy | Site terms | Cookie preferences