How to use curlify - 7 common examples

To help you get started, we’ve selected a few curlify 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 facebook / facebook-business-sdk-codegen / templates / python / facebook_business / api.py View on Github external
files=files,
                timeout=self._session.timeout
            )

        else:
            response = self._session.requests.request(
                method,
                path,
                data=params,
                headers=headers,
                files=files,
                timeout=self._session.timeout
            )
        if self._enable_debug_logger:
            import curlify
            print(curlify.to_curl(response.request))
        fb_response = FacebookResponse(
            body=response.text,
            headers=response.headers,
            http_status=response.status_code,
            call={
                'method': method,
                'path': path,
                'params': params,
                'headers': headers,
                'files': files,
            },
        )

        if fb_response.is_failure():
            raise fb_response.error()
github TACC / agavepy / agavepy / swaggerpy / client.py View on Github external
def __show_curl(self, response_object):
        """Render an HTTP request as a cURL to STDERR
        """
        if self.show_curl:
            try:
                curl_text = curlify.to_curl(response_object.request)
            except Exception as err:
                curl_text = 'Failed to render curl command: {0}'.format(err)
            print_stderr(curl_text)
github mad-ady / home-assistant-customizations / custom_components / kismet / device_tracker.py View on Github external
lon = location["kismet.common.location.avg_loc"]["kismet.common.location.lon"]

                            last_results.append(DeviceGPS(pair["kismet.device.base.macaddr"].upper(), pair["kismet.device.base.name"], (lat,lon), now))
                        else:
                            _LOGGER.debug("["+self.server+"] "+"Couldn't find GPS Coordinates in result..")
                            _LOGGER.debug("["+self.server+"] "+"Try to reproduce with: "+curlify.to_curl(r.request))
                            last_results.append(Device(pair["kismet.device.base.macaddr"].upper(), pair["kismet.device.base.name"], now))
                else:
                    if r.text == "[]":
                        _LOGGER.debug(f"[{self.server}] Nobody in range...")
                    else:
                        _LOGGER.error(f"[{self.server}] Got an error in the kismet reply: {r.text}")
                        _LOGGER.debug(f"[{self.server}] Try to reproduce with: "+curlify.to_curl(r.request))
            else:
                _LOGGER.error(f"[{self.server}] Got an error in the kismet query. Error code {r.status_code}, reply text {r.text}")
                _LOGGER.debug(f"[{self.server}] Try to reproduce with: "+curlify.to_curl(r.request))

        except requests.exceptions.ConnectionError:
            _LOGGER.error("["+self.server+"] "+"Error connecting to kismet instance")

        self.last_results = last_results

        _LOGGER.debug("["+self.server+"] "+"Kismet scan finished")
        return True
github mad-ady / home-assistant-customizations / custom_components / kismet / device_tracker.py View on Github external
lon = 0.0
                            if "kismet.common.location.avg_loc" in location:
                                lat = location["kismet.common.location.avg_loc"]["kismet.common.location.lat"]
                                lon = location["kismet.common.location.avg_loc"]["kismet.common.location.lon"]

                            last_results.append(DeviceGPS(pair["kismet.device.base.macaddr"].upper(), pair["kismet.device.base.name"], (lat,lon), now))
                        else:
                            _LOGGER.debug("["+self.server+"] "+"Couldn't find GPS Coordinates in result..")
                            _LOGGER.debug("["+self.server+"] "+"Try to reproduce with: "+curlify.to_curl(r.request))
                            last_results.append(Device(pair["kismet.device.base.macaddr"].upper(), pair["kismet.device.base.name"], now))
                else:
                    if r.text == "[]":
                        _LOGGER.debug(f"[{self.server}] Nobody in range...")
                    else:
                        _LOGGER.error(f"[{self.server}] Got an error in the kismet reply: {r.text}")
                        _LOGGER.debug(f"[{self.server}] Try to reproduce with: "+curlify.to_curl(r.request))
            else:
                _LOGGER.error(f"[{self.server}] Got an error in the kismet query. Error code {r.status_code}, reply text {r.text}")
                _LOGGER.debug(f"[{self.server}] Try to reproduce with: "+curlify.to_curl(r.request))

        except requests.exceptions.ConnectionError:
            _LOGGER.error("["+self.server+"] "+"Error connecting to kismet instance")

        self.last_results = last_results

        _LOGGER.debug("["+self.server+"] "+"Kismet scan finished")
        return True
github mad-ady / home-assistant-customizations / custom_components / kismet / device_tracker.py View on Github external
location = pair["dot11.advertisedssid.location"]
                         
                        if location and "kismet.common.location.loc_valid" in location and location["kismet.common.location.loc_valid"] == 1:
                            # instead of delving further into the structure, we use the integer coordinates
                            #lat = location["kismet.common.location.avg_lat"] * .000001
                            #lon = location["kismet.common.location.avg_lon"] * .000001
                            lat = 0.0
                            lon = 0.0
                            if "kismet.common.location.avg_loc" in location:
                                lat = location["kismet.common.location.avg_loc"]["kismet.common.location.lat"]
                                lon = location["kismet.common.location.avg_loc"]["kismet.common.location.lon"]

                            last_results.append(DeviceGPS(pair["kismet.device.base.macaddr"].upper(), pair["kismet.device.base.name"], (lat,lon), now))
                        else:
                            _LOGGER.debug("["+self.server+"] "+"Couldn't find GPS Coordinates in result..")
                            _LOGGER.debug("["+self.server+"] "+"Try to reproduce with: "+curlify.to_curl(r.request))
                            last_results.append(Device(pair["kismet.device.base.macaddr"].upper(), pair["kismet.device.base.name"], now))
                else:
                    if r.text == "[]":
                        _LOGGER.debug(f"[{self.server}] Nobody in range...")
                    else:
                        _LOGGER.error(f"[{self.server}] Got an error in the kismet reply: {r.text}")
                        _LOGGER.debug(f"[{self.server}] Try to reproduce with: "+curlify.to_curl(r.request))
            else:
                _LOGGER.error(f"[{self.server}] Got an error in the kismet query. Error code {r.status_code}, reply text {r.text}")
                _LOGGER.debug(f"[{self.server}] Try to reproduce with: "+curlify.to_curl(r.request))

        except requests.exceptions.ConnectionError:
            _LOGGER.error("["+self.server+"] "+"Error connecting to kismet instance")

        self.last_results = last_results
github facebook / facebook-python-business-sdk / facebook_business / api.py View on Github external
files=files,
                timeout=self._session.timeout
            )

        else:
            response = self._session.requests.request(
                method,
                path,
                data=params,
                headers=headers,
                files=files,
                timeout=self._session.timeout
            )
        if self._enable_debug_logger:
            import curlify
            print(curlify.to_curl(response.request))
        fb_response = FacebookResponse(
            body=response.text,
            headers=response.headers,
            http_status=response.status_code,
            call={
                'method': method,
                'path': path,
                'params': params,
                'headers': headers,
                'files': files,
            },
        )

        if fb_response.is_failure():
            raise fb_response.error()
github facebook / facebook-python-business-sdk / facebook_business / api.py View on Github external
files=files,
                timeout=self._session.timeout
            )

        else:
            response = self._session.requests.request(
                method,
                path,
                data=params,
                headers=headers,
                files=files,
                timeout=self._session.timeout
            )
        if self._enable_debug_logger:
            import curlify
            print(curlify.to_curl(response.request))
        fb_response = FacebookResponse(
            body=response.text,
            headers=response.headers,
            http_status=response.status_code,
            call={
                'method': method,
                'path': path,
                'params': params,
                'headers': headers,
                'files': files,
            },
        )

        if fb_response.is_failure():
            raise fb_response.error()

curlify

Library to convert python requests object to curl command.

MIT
Latest version published 5 years ago

Package Health Score

49 / 100
Full package analysis

Popular curlify functions