chore: whitespace trimming

This commit is contained in:
Ankush Menat
2021-09-01 20:23:48 +05:30
parent 77aef302e4
commit f0bcb753fb
26 changed files with 83 additions and 83 deletions

View File

@@ -146,7 +146,7 @@ class LinkedInSettings(Document):
except Exception as e:
self.api_error(response)
return response
def get_headers(self):
@@ -168,7 +168,7 @@ class LinkedInSettings(Document):
raise
except Exception:
self.api_error(response)
def get_post(self, post_id):
url = "https://api.linkedin.com/v2/organizationalEntityShareStatistics?q=organizationalEntity&organizationalEntity=urn:li:organization:{0}&shares[0]=urn:li:share:{1}".format(self.company_id, post_id)
@@ -176,7 +176,7 @@ class LinkedInSettings(Document):
response = requests.get(url=url, headers=self.get_headers())
if response.status_code !=200:
raise
except Exception:
self.api_error(response)

View File

@@ -80,10 +80,10 @@ frappe.ui.form.on('Social Media Post', {
refresh: function(frm) {
frm.trigger('text');
if (frm.doc.docstatus === 1) {
if (!['Posted', 'Deleted'].includes(frm.doc.post_status)) {
frm.trigger('add_post_btn');
frm.trigger('add_post_btn');
}
if (frm.doc.post_status !='Deleted') {
frm.add_custom_button(('Delete Post'), function() {

View File

@@ -53,10 +53,10 @@ class TwitterSettings(Document):
frappe.throw(_('Invalid Consumer Key or Consumer Secret Key'))
def get_api(self):
# authentication of consumer key and secret
auth = tweepy.OAuthHandler(self.consumer_key, self.get_password(fieldname="consumer_secret"))
# authentication of access token and secret
auth.set_access_token(self.access_token, self.access_token_secret)
# authentication of consumer key and secret
auth = tweepy.OAuthHandler(self.consumer_key, self.get_password(fieldname="consumer_secret"))
# authentication of access token and secret
auth.set_access_token(self.access_token, self.access_token_secret)
return tweepy.API(auth)
@@ -90,20 +90,20 @@ class TwitterSettings(Document):
def delete_tweet(self, tweet_id):
api = self.get_api()
try:
try:
api.destroy_status(tweet_id)
except TweepError as e:
self.api_error(e)
def get_tweet(self, tweet_id):
api = self.get_api()
try:
try:
response = api.get_status(tweet_id, trim_user=True, include_entities=True)
except TweepError as e:
self.api_error(e)
return response._json
def api_error(self, e):
content = json.loads(e.response.content)
content = content["errors"][0]