Skip to main content

httpie-ems-auth

This HTTPie auth plugin implements Escher authentication for Emarsys API requests.

Installation

Be sure that HTTPie is installed, and install this plugin:

$ pip install httpie-ems-auth

After installing, you will see the option ems-auth under --auth-type if you run $ http --help.

Example

Suiteable if you call the API of Suite

$ http --auth-type=ems-auth --auth=escher_key:escher_secret https://api.emarsys.net/api/v2/internal/12345678/settings

The default Escher credential scope is “eu/suite/ems_request” which identifies Suite. If u are calling another service, you have to alter the credential scope like this:

$ http --auth-type=ems-auth --auth=eu/suite/ems_request/escher_key:escher_secret https://api.emarsys.net/api/v2/internal/12345678/settings

Check out HTTPie sessions if you would like to save authentication information between your requests.

If you want to use in python code this example can help:
import escherauth
import datetime
from urlparse import urlparse
import requests

escher_key = 'test'
escher_secret = 'test'
options = {
            'algo_prefix': 'EMS',
            'vendor_key': 'EMS',
            'hash_algo': 'SHA256',
            'auth_header_name': 'X-Ems-Auth',
            'date_header_name': 'X-Ems-Date'
          }

credential_scope = "test"

if "/" in escher_key:
    scope = escher_key.split("/")
    escher_key = scope.pop()
    credential_scope = "/".join(scope)

client = {'api_key': escher_key, 'api_secret': escher_secret}
escher = escherauth.Escher(credential_scope, options)

url = 'http://test-escher-url.com/api/call/smth'

r = requests.PreparedRequest()
r.prepare('GET',url)
now = datetime.datetime.utcnow()
r.headers['X-Ems-Date'] = now.strftime('%Y%m%dT%H%M%SZ')
parsed_uri = urlparse(r.url)
r.headers['Host'] = parsed_uri.netloc

f = escher.sign(r, client)
s = requests.Session()

s.send(f)

Metadata

Release files for httpie-ems-auth 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for httpie-ems-auth 0.2.2
File Size Uploaded Provenance Actions
httpie-ems-auth-0.2.2.tar.gz 2.9 kB Without provenance Details for httpie-ems-auth-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for httpie-ems-auth 0.2.2
File Interpreter ABI Platform Actions
httpie_ems_auth-0.2.2-py2.7.egg Legacy Egg format - - Details for httpie_ems_auth-0.2.2-py2.7.egg

Total release size: 7.4 kB

Release files / httpie-ems-auth-0.2.2.tar.gz

Download URL httpie-ems-auth-0.2.2.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f756a92ddb358241d708b85e6ba57e694a1d31c2c37ed3002dabaff906c1f74f
BLAKE2b-256 checksum
How to use checksums
b85253fe718352385867f3779880c6f332a3b5e7d00ee60cb4eecd6641e09d11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / httpie_ems_auth-0.2.2-py2.7.egg

Download URL httpie_ems_auth-0.2.2-py2.7.egg
Size 4.6 kB
Tags Egg
SHA-256 checksum
How to use checksums
4347afac240914296af9f83f9e54400a2953e403e17661708e872dc208e99ab3
BLAKE2b-256 checksum
How to use checksums
8173768f14774b9b22f4871fbe9867ef0925b104ff85e586ac2a1b863edd5b61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for httpie-ems-auth 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page