Jump to content

HTTPPaymentRequired(


dheeraj.bana

Recommended Posts

Hi Guys,

I am facing problem during the create and shot entry with ftrack new API.

I am ruing same example code which is given in migrating_from_old_api to new Api

New API:

code link: http://ftrack-python-api.rtd.ftrack.com/en/stable/release/migrating_from_old_api.html?highlight=sequence 

But i am facing Below mention error.

ServerError: Server reported error: HTTPPaymentRequired(The status is not valid for this object)

Any suggestion??

Link to comment
Share on other sites

code is:

project = session.query('Project where name is "my_test"').one()

sequence = session.create('Sequence', { 'name': '055', 'parent': project })

shot = session.create('Shot', { 'name': '099', 'parent': sequence })

session.commit()

Error is:

ServerError: Server reported error: HTTPPaymentRequired(The status is not valid for this object)

Any suggestion??

Link to comment
Share on other sites

 session.commit()

/python2.7/site-packages/ftrack_api/session.py in commit(self)
   1157         # Process batch.
   1158         if batch:
-> 1159             result = self._call(batch)
   1160 
   1161             # Clear recorded operations.

/python2.7/site-packages/ftrack_api/session.py in _call(self, data)
   1526                 )
   1527                 self.logger.error(error_message)
->1528                 raise ftrack_api.exception.ServerError(error_message)
   1529 
   1530         return result

ServerError: Server reported error: HTTPPaymentRequired(The status is not valid for this object)

Link to comment
Share on other sites

Thanks Mattias for reply,

above "Status" error has been gone!! But i just want to create Sequence object without any children.

Code is 

sequence = session.create('Sequence')

sequence['name']='333'

sequence['parent']=project

sequence['status']=default_sequence_status

sequence['type']=seqtype
session.commit()

Error is :

ServerError: Server reported error: KeyError('tasks')

Link to comment
Share on other sites

22 hours ago, dheeraj.bana said:

above "Status" error has been gone!! But i just want to create Sequence object without any children.

 

Could you provide a complete reproducible example of this code? I.e. including querying for the project, default_sequence_status, etc.

One thing to verify; have you added type and status to the Sequence object? In the default setup of ftrack Sequence does not have status or type.

Link to comment
Share on other sites

Sure,

session = ftrack_api.Session()
project = session.query('Project where name is "toy"').one()


project_schema = project['project_schema']
default_seq_status = project_schema.get_statuses('Sequence')[1] # 'Ready to start'
seqtype = session.query('Sequence').first()

sequence = session.create('Sequence')
sequence['name']='222'
sequence['parent']=project
sequence['status']=default_seq_status
sequence['type']=seqtype

session.commit()

Link to comment
Share on other sites

Hi,

You have misunderstood how to retrieve a type for the sequence object. The following will return a Sequence instance, and assign it to the seqtype variable.

seqtype = session.query('Sequence').first()

 

What you want to do, is to retrieve a `Type` instance, which can be used for the sequence. The migration guide you linked shows how to do this.

seqtype = project_schema.get_types('Sequence')[0]

 

Please also note that Sequences can not have a type attribute as standard. This can be configured under "Objects" in system settings.
 

Regards,
Lucas

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...