How to use the vine.VineError function in vine

To help you get started, we’ve selected a few vine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github starlock / vino / vine.py View on Github external
"""
        url = BASE_URL + call
        headers = {"User-Agent": "com.vine.iphone/1.0.3 (unknown, iPhone OS 6.0.1, iPhone, Scale/2.000000)",
                   "Accept-Language": "en, sv, fr, de, ja, nl, it, es, pt, pt-PT, da, fi, nb, ko, zh-Hans, zh-Hant, ru, pl, tr, uk, ar, hr, cs, el, he, ro, sk, th, id, ms, en-GB, ca, hu, vi, en-us;q=0.8"}
        if self._key:
            headers["vine-session-id"] = self._key

        if data:
            r = requests.post(url, params=params, data=data, headers=headers, verify=False)
        else:
            r = requests.get(url, params=params, headers=headers, verify=False)

        try:
            data = r.json()
            if data.get("success") is not True:
                raise VineError(data)
            return data
        except:
            logging.error(r.text)
            raise