Created
September 17, 2013 23:20
-
-
Save deserat/6602053 to your computer and use it in GitHub Desktop.
api example of posting a file. The content file object is part of django but it's easily separated if you use python. Just copy that class out https://github.com/django/django/blob/master/django/core/files/base.py#L132
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.files.base import ContentFile | |
f = ContentFile(o.read(), name='pic.png') | |
response = signed_post(self.api_client, self.c, '/api/v1/user/register/', { | |
'social_id': 'twitter:123452', | |
'gender': 'f', | |
'email': '[email protected]', | |
'name': 'whatevs', | |
'location': 'New York', | |
'dob': '2000-01-11', | |
'country': 'USA', | |
'pic': f, | |
}) | |
o.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment