Skip to content
This repository has been archived by the owner on Aug 20, 2023. It is now read-only.

Not able to create a simple list #8

Closed
vasiliyb opened this issue Sep 10, 2013 · 1 comment
Closed

Not able to create a simple list #8

vasiliyb opened this issue Sep 10, 2013 · 1 comment

Comments

@vasiliyb
Copy link

Folks, the documentation seems to be incorrect. Not able to create a simple list via the following:

import mailjet
mailjet_api = mailjet.Api(api_key='x', secret_key='y')
contact_list = mailjet_api.lists.create(label='test',name='Test list',method='POST')

Receive:

HTTPError                                 Traceback (most recent call last)
<ipython-input-6-9260c9fd8821> in <module>()
----> 1 contact_list = mailjet_api.lists.create(label='test',name='Test list',method='POST')

/usr/lib/python2.6/site-packages/mailjet-1.3.1-py2.6.egg/mailjet/api.pyc in __call__(self, **kwargs)
     40             self.function,
     41             options=options,
---> 42             postdata=postdata,
     43         )
     44         return json.load(response)

/usr/lib/python2.6/site-packages/mailjet-1.3.1-py2.6.egg/mailjet/connection.pyc in open(self, method, function, options, postdata)
     48
     49         opener = self.get_opener(url)
---> 50         return opener.open(url, poststring, self.timeout)
     51
     52     @classmethod

/usr/lib64/python2.6/urllib2.pyc in open(self, fullurl, data, timeout)
    395         for processor in self.process_response.get(protocol, []):
    396             meth = getattr(processor, meth_name)
--> 397             response = meth(req, response)
    398
    399         return response

/usr/lib64/python2.6/urllib2.pyc in http_response(self, request, response)
    508         if not (200 <= code < 300):
    509             response = self.parent.error(
--> 510                 'http', request, response, code, msg, hdrs)
    511
    512         return response

/usr/lib64/python2.6/urllib2.pyc in error(self, proto, *args)
    427             http_err = 0
    428         args = (dict, proto, meth_name) + args
--> 429         result = self._call_chain(*args)
    430         if result:
    431             return result

/usr/lib64/python2.6/urllib2.pyc in _call_chain(self, chain, kind, meth_name, *args)
    367             func = getattr(handler, meth_name)
    368
--> 369             result = func(*args)
    370             if result is not None:
    371                 return result

/usr/lib64/python2.6/urllib2.pyc in http_error_401(self, req, fp, code, msg, headers)
    878         url = req.get_full_url()
    879         response = self.http_error_auth_reqed('www-authenticate',
--> 880                                               url, req, headers)
    881         self.reset_retry_count()
    882         return response

/usr/lib64/python2.6/urllib2.pyc in http_error_auth_reqed(self, authreq, host, req, headers)
    856                 scheme, quote, realm = mo.groups()
    857                 if scheme.lower() == 'basic':
--> 858                     return self.retry_http_basic_auth(host, req, realm)
    859
    860     def retry_http_basic_auth(self, host, req, realm):

/usr/lib64/python2.6/urllib2.pyc in retry_http_basic_auth(self, host, req, realm)
    866                 return None
    867             req.add_unredirected_header(self.auth_header, auth)
--> 868             return self.parent.open(req, timeout=req.timeout)
    869         else:
    870             return None

/usr/lib64/python2.6/urllib2.pyc in open(self, fullurl, data, timeout)
    395         for processor in self.process_response.get(protocol, []):
    396             meth = getattr(processor, meth_name)
--> 397             response = meth(req, response)
    398
    399         return response

/usr/lib64/python2.6/urllib2.pyc in http_response(self, request, response)
    508         if not (200 <= code < 300):
    509             response = self.parent.error(
--> 510                 'http', request, response, code, msg, hdrs)
    511
    512         return response

/usr/lib64/python2.6/urllib2.pyc in error(self, proto, *args)
    433         if http_err:
    434             args = (dict, 'default', 'http_error_default') + orig_args
--> 435             return self._call_chain(*args)
    436
    437 # XXX probably also want an abstract factory that knows when it makes

/usr/lib64/python2.6/urllib2.pyc in _call_chain(self, chain, kind, meth_name, *args)
    367             func = getattr(handler, meth_name)
    368
--> 369             result = func(*args)
    370             if result is not None:
    371                 return result

/usr/lib64/python2.6/urllib2.pyc in http_error_default(self, req, fp, code, msg, hdrs)
    516 class HTTPDefaultErrorHandler(BaseHandler):
    517     def http_error_default(self, req, fp, code, msg, hdrs):
--> 518         raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    519
    520 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 400: Bad Request
@wolph
Copy link
Owner

wolph commented Sep 11, 2013

Indeed, I have fixed the documentation. Apparently I used a different name while actually testing the API

@wolph wolph closed this as completed Sep 11, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants