Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing session in order to pass key or otherwise we get Http-401 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion source/covalent_api/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def query(self, url, params=None, decode=True):
True by default.
:type decode: boolean
'''
url = "{}{}".format(self._server_url, url)
url = "{}{}?&key={}".format(self._server_url, url, self.api_key)


self.logger.debug("Url: {}".format(url))
Expand Down
23 changes: 23 additions & 0 deletions tests/test_class_a.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import unittest
import covalent_api
import mock
import os

SERVER_URL="https://api.covalenthq.com"


class TestClass(unittest.TestCase):

@classmethod
def setUpClass(cls) -> None:
cls.APIKEY = os.environ.get('COVALENT_API_KEY')
if not cls.APIKEY:
raise Exception("Need to set COVALENT_API_KEY in order to run tests.")
cls.session = covalent_api.session.Session(server_url=SERVER_URL, api_key=cls.APIKEY)
cls.cl_a = covalent_api.class_a.ClassA(cls.session)

def test_get_transactions(self):
ret = self.cl_a.get_transactions(chain_id="1", address="0x74c1e4b8cae59269ec1d85d3d4f324396048f4ac")
print(ret)
assert 'data' in ret