Skip to content

style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf #1262

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

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
import requests

from .exceptions.pi_network_exceptions import PiNetworkApiException


class PiApiService:

def __init__(self, api_endpoint, api_key, api_secret):
self.api_endpoint = api_endpoint
self.api_key = api_key
self.api_secret = api_secret

def get_blockchain_info(self):
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {self.api_key}'
"Content-Type": "application/json",
"Authorization": f"Bearer {self.api_key}",
}
response = requests.get(f'{self.api_endpoint}/blockchain', headers=headers)
response = requests.get(f"{self.api_endpoint}/blockchain", headers=headers)
if response.status_code != 200:
raise PiNetworkApiException(response.status_code, response.text)
return response.json()

def broadcast_transaction(self, transaction):
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {self.api_key}'
"Content-Type": "application/json",
"Authorization": f"Bearer {self.api_key}",
}
response = requests.post(f'{self.api_endpoint}/transaction', json=transaction, headers=headers)
response = requests.post(
f"{self.api_endpoint}/transaction", json=transaction, headers=headers
)
if response.status_code != 201:
raise PiNetworkApiException(response.status_code, response.text)
return response.json()

def verify_transaction(self, transaction):
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {self.api_key}'
"Content-Type": "application/json",
"Authorization": f"Bearer {self.api_key}",
}
response = requests.get(f'{self.api_endpoint}/transaction/{transaction["hash"]}', headers=headers)
response = requests.get(
f'{self.api_endpoint}/transaction/{transaction["hash"]}', headers=headers
)
if response.status_code != 200:
raise PiNetworkApiException(response.status_code, response.text)
return response.json()
Loading