Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Aveek aveek22

🏠
Working from home
View GitHub Profile
View social_linkedin_share_post_organization.py
url = "https://api.linkedin.com/v2/shares"
headers = {
'Authorization' : f'Bearer {access_token}',
'Content-Type' : 'application/json'
}
payload = {
"content": {
"contentEntities": [
View social_linkedin_share_post_personal.py
url = "https://api.linkedin.com/v2/shares"
headers = {
'Authorization' : f'Bearer {access_token}',
'Content-Type' : 'application/json'
}
payload = {
"content": {
"contentEntities": [
View social_linkedin_profile.py
# Get LinkedIn user ID
url = "https://api.linkedin.com/v2/me"
header = {
'Authorization' : f'Bearer {access_token}'
}
response = requests.get(url=url, headers=header)
response_json_li_person = response.json()
View social_linkedin_access_token.py
url_access_token = "https://www.linkedin.com/oauth/v2/accessToken"
auth_code = "YOUR_AUTH_CODE_FROM_PREVIOUS_VERIFICATION"
payload = {
'grant_type' : 'authorization_code',
'code' : auth_code,
'redirect_uri' : redirect_uri,
'client_id' : client_id,
'client_secret' : client_secret
}
View social_linkedin_auth.py
base_url = "https://www.linkedin.com/oauth/v2/authorization"
redirect_uri = "https://thedatascholar.com/auth/linkedin/callback"
scope = "w_member_social,r_liteprofile"
url = f"{base_url}?response_type=code&client_id={client_id}&state=random&redirect_uri={redirect_uri}&scope={scope}"
print(url)
View social_linkedin_static_import.py
import requests # To deal with REST APIs
# Get the ClientID and ClientSecret to get the access token
client_id = "YOUR_CLIENT_ID"
client_secret = "YOUR_CLIENT_SECRET"
organization_id = "YOUR_ORGANIZATION_ID"
View social_linkedin_access_token.py
url_access_token = "https://www.linkedin.com/oauth/v2/accessToken"
auth_code = "YOUR_AUTH_CODE_FROM_PREVIOUS_VERIFICATION"
payload = {
'grant_type' : 'authorization_code',
'code' : auth_code,
'redirect_uri' : redirect_uri,
'client_id' : client_id,
'client_secret' : client_secret
}
View wordpress_posts.py
import requests
from config import Config
WORDPRESS_URL = 'https://public-api.wordpress.com/'
AUTH_TOKEN_URL = f'{WORDPRESS_URL}oauth2/token'
POSTS_URL = f'{WORDPRESS_URL}rest/v1.1/sites/{Config.SITE_ID}/posts/{Config.POST_ID}'
View postgresql_point_datatype.sql
DROP TABLE IF EXISTS SQLShackGeomTest;
CREATE TABLE SQLShackGeomTest (
sensor_id VARCHAR(50) PRIMARY KEY NOT NULL,
longitude VARCHAR(50),
latitude VARCHAR(50),
country TEXT,
sensorTemp INTEGER,
sensorPressure INTEGER,
sensorTime TIMESTAMP,
View athena_sql_server.sql
EXEC master.dbo.sp_addlinkedserver
@server =N'AWS_ATHENA',
@srvproduct=N'',
@provider=N'MSDASQL',
@datasrc=N'AWS_ATHENA'
GO
EXEC master.dbo.sp_addlinkedsrvlogin
@rmtsrvname=N'AWS_ATHENA',
@useself=N'False',