mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-01 03:09:09 +00:00
chore: whitespace / eof fixes
This commit is contained in:
@@ -371,4 +371,3 @@ def add_lead_to_prospect(lead, prospect):
|
||||
prospect.save(ignore_permissions=True)
|
||||
frappe.msgprint(_('Lead {0} has been added to prospect {1}.').format(frappe.bold(lead), frappe.bold(prospect.name)),
|
||||
title=_('Lead Added'), indicator='green')
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class Prospect(Document):
|
||||
|
||||
def on_update(self):
|
||||
self.link_with_lead_contact_and_address()
|
||||
|
||||
|
||||
def on_trash(self):
|
||||
self.unlink_dynamic_links()
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user