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 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 rds-template-mysql.yaml
Parameters:
pDbName:
Type: String
pDbUser:
Type: String
pDbPass:
Type: String
Description: "It should be less than 8 characters"
Resources:
View flask_app.py
from flask import Flask
from flask_restful import Api, Resource, reqparse
import pandas as pd
app = Flask(__name__)
api = Api(app)
class Users(Resource):
def get(self):
data = pd.read_csv('users.csv')
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
}