
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
instagram-basic-display
Advanced tools
A simple Python library for accessing the Instagram Basic Display API
A simple Python library for the Instagram Basic Display API. Based on the instagram-basic-display-php by espresso.dev
PyPI package available.
To use the Instagram Basic Display API, you will need to register a Facebook app and configure Instagram Basic Display. Follow the getting started guide.
I strongly advice using PyPI to keep updates as smooth as possible.
$ pip3 install instagram-basic-display
from instagram_basic_display.InstagramBasicDisplay import InstagramBasicDisplay
instagram_basic_display = InstagramBasicDisplay(app_id='YOUR_APP_ID', app_secret='YOUR_APP_SECRET', redirect_url='YOUR_APP_REDIRECT_URI')
# Optionally you can force graph version using optional parameter `graph_version`:
# instagram_basic_display = InstagramBasicDisplay(app_id='YOUR_APP_ID', app_secret='YOUR_APP_SECRET', redirect_url='YOUR_APP_REDIRECT_URI', graph_version='v16.0')
print(instagram_basic_display.get_login_url()) # Returns login URL you need to follow
# Get the OAuth callback code
code = request.args.get('code')
# Get the short lived access token (valid for 1 hour)
short_lived_token = instagram_basic_display.get_o_auth_token(code)
# Exchange this token for a long lived token (valid for 60 days)
long_lived_token = instagram_basic_display.get_long_lived_token(short_lived_token.get('access_token'))
print('Your token is: {}' .format(long_lived_token.access_token))
# Set user access token
instagram_basic_display.set_access_token(long_lived_token.access_token)
# Get the users profile
profile = instagram_basic_display.get_user_profile()
print(profile)
Instagram(app_id: str, app_secret: str, redirect_url: str)
get_login_url(scopes: list=None)
get_o_auth_token(code: str)
get_long_lived_token(access_token)
refresh_token(access_token)
set_access_token($token)
get_access_token()
Authenticated methods
get_user_profile()
get_user_media(user_id='me', limit: int = None, before: int = None, after: int = None)
user_id
isn't defined or equals 'me'
, it returns the media of the logged in userAuthenticated methods
get_media(_id: int)
get_media_children(_id: int)
The get_user_media
endpoint has a maximum range of results, so increasing the limit
parameter above the limit of 99 won't help.You can use pagination to return more results for this endpoint.
Pass an object into the pagination()
method and receive your next dataset:
media = instagram_basic_display.get_user_media()
more_media = instagram_basic_display.pagination(media)
FAQs
A simple Python library for accessing the Instagram Basic Display API
We found that instagram-basic-display demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.