--- /dev/null
+import httplib2
+from poster.encode import multipart_encode
+from poster.streaminghttp import register_openers
+import sys
+import getpass
+
+register_openers()
+
+datagen, headers = multipart_encode({'book_xml_file': open(sys.argv[1], "rb")})
+data = ''.join(list(datagen))
+for key, value in headers.items():
+ headers[key] = str(value)
+
+password = getpass.getpass()
+
+h = httplib2.Http()
+h.add_credentials('zuber', password)
+h.follow_all_redirects = True
+
+resp, content = h.request(
+ 'http://localhost:8000/api/books.json',
+ 'POST',
+ body=data,
+ headers=headers
+)
+print resp, content
\ No newline at end of file
url(r'^uzytkownicy/wyloguj/$', 'catalogue.views.logout_then_redirect', name='logout'),
url(r'^uzytkownicy/utworz/$', 'catalogue.views.register', name='register'),
+ # API
+ (r'^api/', include('api.urls')),
+
# Static files
url(r'^%s(?P<path>.*)$' % settings.MEDIA_URL[1:], 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),