Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 103 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Created by https://www.gitignore.io/api/python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# End of https://www.gitignore.io/api/python
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ coincheck
The easiest Bitcoin Exchange in Japan
https://coincheck.jp/

## Install

```
pip install git+https://github.com/coincheckjp/coincheck-python
```

## Usage

```python
Expand Down
Empty file added coincheck/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/coincheck/coincheck.py → coincheck/coincheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __getattr__(self, attr):
def setSignature(self, path, arr):
nonce = str(round(time.time() * 1000))
url = 'https://' + self.apiBase + path
message = nonce + url + json.dumps(arr)
message = nonce + url + (json.dumps(arr) if arr else '')
signature = hmac.new(self.secretKey.encode('utf-8'), message.encode('utf-8'), hashlib.sha256).hexdigest()
self.request_headers.update({
'ACCESS-NONCE': nonce,
Expand All @@ -70,7 +70,7 @@ def request(self, method, path, params):
if (method == ServiceBase.METHOD_POST or method == ServiceBase.METHOD_DELETE):
data = json.dumps(params).encode('utf-8')
self.request_headers = {
'content-type': "application/json"
'content-type': 'application/json'
}

self.setSignature(path, params)
Expand All @@ -81,4 +81,4 @@ def request(self, method, path, params):
self.client.request(method, path, data, self.request_headers)
res = self.client.getresponse()
data = res.read()
return data.decode("utf-8")
return json.loads(data.decode('utf-8'))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!usr/bin/env python

from setuptools import setup, find_packages

setup(name="coincheck",
version="0.1.0",
description="coincheck",
url="https://github.com/coincheckjp/coincheck-python",
packages=find_packages()
)
File renamed without changes.