mirror of
https://github.com/yawaflua/python-qiwi.git
synced 2026-02-04 01:44:12 +02:00
Optimize code
Вместо "str" + str(data) + "str" можно использовать f"str{data}str", получается одинаково, но второй вариант читать легче, как и записывать в код
This commit is contained in:
@@ -32,7 +32,7 @@ class QiwiWаllet():
|
|||||||
json: information about the success of the translation
|
json: information about the success of the translation
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sum_p2p = str(int(sum_p2p)) + '.00'
|
sum_p2p = f'{sum_p2p}.00'
|
||||||
self.s.headers = {
|
self.s.headers = {
|
||||||
'content-type': 'application/json',
|
'content-type': 'application/json',
|
||||||
'User-Agent': 'Android v3.2.0 MKT',
|
'User-Agent': 'Android v3.2.0 MKT',
|
||||||
@@ -61,8 +61,7 @@ class QiwiWаllet():
|
|||||||
|
|
||||||
parameters = {'rows': str(
|
parameters = {'rows': str(
|
||||||
rows_num), 'nextTxnId': '', 'nextTxnDate': ''}
|
rows_num), 'nextTxnId': '', 'nextTxnDate': ''}
|
||||||
h = self.s.get('https://edge.qiwi.com/payment-history/v2/persons/' +
|
h = self.s.get(f'https://edge.qiwi.com/payment-history/v2/persons/{self.phone}/payments', params=parameters)
|
||||||
self.phone + '/payments', params=parameters)
|
|
||||||
return h.json()
|
return h.json()
|
||||||
|
|
||||||
def bill(self):
|
def bill(self):
|
||||||
@@ -96,8 +95,7 @@ class QiwiWаllet():
|
|||||||
self.s.headers['Accept'] = 'application/json'
|
self.s.headers['Accept'] = 'application/json'
|
||||||
|
|
||||||
b = self.s.get(
|
b = self.s.get(
|
||||||
'https://edge.qiwi.com/funding-sources/v2/persons/' + self.phone +
|
'https://edge.qiwi.com/funding-sources/v2/persons/{self.phone}/accounts')
|
||||||
'/accounts')
|
|
||||||
return b.json()
|
return b.json()
|
||||||
|
|
||||||
def balance(self):
|
def balance(self):
|
||||||
@@ -109,7 +107,7 @@ class QiwiWаllet():
|
|||||||
self.s.headers['Accept'] = 'application/json'
|
self.s.headers['Accept'] = 'application/json'
|
||||||
|
|
||||||
b = self.s.get(
|
b = self.s.get(
|
||||||
'https://edge.qiwi.com/funding-sources/v2/persons/' + self.phone + '/accounts')
|
'https://edge.qiwi.com/funding-sources/v2/persons/{self.phone}/accounts')
|
||||||
b = b.json()
|
b = b.json()
|
||||||
b = b['accounts'][0]['balance']['amount']
|
b = b['accounts'][0]['balance']['amount']
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user