https://github.com/mzuvin/facebook-accesstoken-tool
facebook accesstoken never expire with python login
https://github.com/mzuvin/facebook-accesstoken-tool
access-token facebook facebook-api facebook-graph-api facebook-login python
Last synced: about 1 year ago
JSON representation
facebook accesstoken never expire with python login
- Host: GitHub
- URL: https://github.com/mzuvin/facebook-accesstoken-tool
- Owner: mzuvin
- Created: 2018-08-29T12:41:28.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-29T12:47:36.000Z (almost 8 years ago)
- Last Synced: 2025-03-20T17:56:12.008Z (about 1 year ago)
- Topics: access-token, facebook, facebook-api, facebook-graph-api, facebook-login, python
- Language: Python
- Homepage:
- Size: 1.95 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# facebook-accesstoken-tool
facebook accesstoken never expire
```python
import requests
import re
def get_token(username, password):
data = {"email" : username, "pass" : password}
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36"}
s = requests.Session()
s.get("http://www.facebook.com")
s.post("https://www.facebook.com/login.php?login_attempt=1&1wv=110", data=data)
r = s.get("https://www.facebook.com/"+str(username), headers=headers)
regex = r"access_token:\"([A-Za-z0-9]+)\""
token=re.findall(regex,r.text)
print token[0]
return token[0]
get_token("username","password")
```