Skip to content

Instantly share code, notes, and snippets.

@MartijnBraam
Created May 9, 2016 11:19
Show Gist options
  • Save MartijnBraam/22054257651193d319917c4073aa97b5 to your computer and use it in GitHub Desktop.
Save MartijnBraam/22054257651193d319917c4073aa97b5 to your computer and use it in GitHub Desktop.
Drupal services python module example
shop = DrupalService('http://brixit.nl/api', 'username', 'password')
class Article(Node):
body = BodyTextField()
image = ImageField(machine_name='field_image')
tags = TermReferenceField(machine_name='field_tags', limit=0, vocabulary='labels')
class Meta:
drupal = shop
example = Article.get(49)
example.author = 'Martijn'
example.save()
blog_post = Article()
blog_post.author = "Martijn"
blog_post.body.value = "Test"
blog_post.image.load_existing_file(fid=21)
blog_post.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment