Skip to content

Commit

Permalink
add headers to http requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Atif Nazir committed Aug 16, 2020
1 parent d0d6a34 commit 6135e6e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
This Python package is the official reference client for the Block.io payments API. To use this, you will need the Dogecoin, Bitcoin, or Litecoin API key(s) from <a href="https://block.io" target="_blank">Block.io</a>. Go ahead, sign up :)

#### ATTENTION: Package name has changed from block_io to block-io for PyPi.
#### COMPATIBILITY: Please use Python2.7+. Also compatible with Python 3.0+.
#### COMPATIBILITY: Please use Python3.0+. Also compatible with Python 2.7.

## Installation

[Using virtualenv is recommended when installing Python packages](https://packaging.python.org/en/latest/installing.html#virtual-environments).

Install the package using `pip` for **Python 2.7+**:
Install the package using `pip`:

pip install block-io

Expand All @@ -34,7 +34,7 @@ For more information, see [Python API Docs](https://block.io/api/simple/python).

## Windows Users, Please Note:

You can install it like so on Windows: "pip install block-io==1.1.13"
You can install it like so on Windows: "pip install block-io==1.1.15"

Now regarding the vcvarsall.bat error -- that error is due to the fact that pycrypto library is being compiled when you're trying to install the block-io library.

Expand All @@ -51,7 +51,7 @@ Once this is done, go to C:\Python3.4\Lib\distutils, and create a file calls "di
compiler=mingw32


Now exit your Command Prompt or Python IDE, go to Command Prompt again, type "pip install block-io==1.1.13".
Now exit your Command Prompt or Python IDE, go to Command Prompt again, type "pip install block-io==1.1.15".


## Contributing
Expand Down
3 changes: 2 additions & 1 deletion block_io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def __init__(self, api_key, pin, version = 2):
self.base_url = 'https://block.io/api/v'+str(version)+'/API_CALL/?api_key='+api_key
self.withdraw_calls = ['withdraw', 'withdraw_from_address', 'withdraw_from_addresses', 'withdraw_from_label', 'withdraw_from_labels', 'withdraw_from_user_id', 'withdraw_from_users']
self.sweep_calls = ['sweep_from_address']
self.request_headers = {'Accept': 'application/json', 'User-Agent': 'python:block_io:'+self.clientVersion}

def __getattr__(self, attr, *args, **kwargs):

Expand Down Expand Up @@ -279,7 +280,7 @@ def api_call(self, method, **kwargs):

# update the parameters with the API key
session = requests.session()
response = session.post(self.base_url.replace('API_CALL',method), data = payload)
response = session.post(self.base_url.replace('API_CALL',method), data = payload, headers = self.request_headers)
status_code = response.status_code

try:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
long_description = fh.read()

setup(name='block-io',
version='1.1.14',
version='1.1.15',
description='The easiest way to integrate Bitcoin, Dogecoin and Litecoin in your applications. Sign up at Block.io for your API key.',
url='https://github.com/BlockIo/block_io-python',
author='Atif Nazir',
Expand Down

0 comments on commit 6135e6e

Please sign in to comment.