Request

itunesiap.request

class itunesiap.request.Request(receipt_data, password=None, exclude_old_transactions=False, **kwargs)

Validation request with raw receipt.

Use verify method to try verification and get Receipt or exception. For detail, see also the Apple document: https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html.

Parameters:
  • receipt_data (str) – An iTunes receipt data as Base64 encoded string.
  • password (str) – Only used for receipts that contain auto-renewable subscriptions. Your app’s shared secret (a hexadecimal string).
  • exclude_old_transactions (bool) – Only used for iOS7 style app receipts that contain auto-renewable or non-renewing subscriptions. If value is true, response includes only the latest renewal transaction for any subscriptions.
  • proxy_url – A proxy url to access the iTunes validation url. (It is an attribute of verify() but misplaced here)
aioverify(**options)

Try to verify the given receipt with current environment.

Note that python3.4 support is only available at itunesiap==2.5.1

See also:
Parameters:
  • env (itunesiap.environment.Environment) – Override the environment.
  • timeout (float) – The value is connection timeout of the verifying request. The default value is 30.0 when no env is given.
  • use_production (bool) – The value is weather verifying in production server or not. The default value is bool True when no env is given.
  • use_sandbox (bool) – The value is weather verifying in sandbox server or not. The default value is bool False when no env is given.
  • verify_ssl (bool) – The value will be ignored.
Returns:

itunesiap.receipt.Receipt object if succeed.

Raises:

Otherwise raise a request exception.

request_content

Instantly built request body for iTunes.

verify(**options)

Try verification with current environment.

See also:
Parameters:
  • env (itunesiap.environment.Environment) – Override the environment.
  • timeout (float) – The value is connection timeout of the verifying request. The default value is 30.0 when no env is given.
  • use_production (bool) – The value is weather verifying in production server or not. The default value is bool True when no env is given.
  • use_sandbox (bool) – The value is weather verifying in sandbox server or not. The default value is bool False when no env is given.
  • verify_ssl (bool) – The value is weather enabling SSL verification or not. WARNING: DO NOT TURN IT OFF WITHOUT A PROPER REASON. IF YOU DON’T UNDERSTAND WHAT IT MEANS, NEVER SET IT YOURSELF.
Returns:

itunesiap.receipt.Receipt object if succeed.

Raises:

Otherwise raise a request exception.

verify_from(url, timeout=None, verify_ssl=True)

The actual implemention of verification request.

verify() calls this method to try to verifying for each servers.

Parameters:
  • url (str) – iTunes verification API URL.
  • timeout (float) – The value is connection timeout of the verifying request. The default value is 30.0 when no env is given.
  • verify_ssl (bool) – SSL verification.
Returns:

itunesiap.receipt.Receipt object if succeed.

Raises:

Otherwise raise a request exception.

itunesiap.exceptions

exception itunesiap.exceptions.ItunesServerNotAvailable(*args, **kwargs)

iTunes server is not available. No response.

exception itunesiap.exceptions.ItunesServerNotReachable(*args, **kwargs)

iTunes server is not reachable - including connection timeout.

exception itunesiap.exceptions.InvalidReceipt(response_data)

A receipt was given by iTunes server but it has error.