Skip to content

Instantly share code, notes, and snippets.

dx dequis

Block or report user

Report or block dequis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kevinburke
kevinburke / curl.jinja
Last active Oct 18, 2016
Turn a requests request back into (roughly) the HTTP request that went over the wire. Also translates the request into a curl command
View curl.jinja
curl -X{{ method }} {{ url }}
{%- if query_string|length %}?{% endif %}
{{- query_string }} \
{%- for header, value in headers.iteritems() %}
-H '{{ header|urlencode }}: {{ value|urlencode }}'{% if not loop.last or params|length or auth %} \{% endif %}
{%- endfor -%}
{% if params|length %}{% for param, value in params.iteritems() %}
-d '{{ param.decode('utf-8')|urlencode }}={{ value.decode('utf-8')|urlencode }}'{% if not loop.last or auth %} \{% endif %}
{%- endfor %}{%- endif %}
{%- if auth %}
You can’t perform that action at this time.