Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(facebook): :sparkles: add page default picture return. #20

Merged
merged 2 commits into from Nov 13, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Next

feat(facebook): add page default picture return.

  • Loading branch information
MerleLiuKun committed Nov 13, 2019
commit 6c8f9ffc983ab01002741456945bbab14b2843c4
@@ -203,6 +203,7 @@ def __init__(self, **kwargs):
'link': None,
'name': None,
'phone': None,
'picture': None,
'rating_count': None,
'single_line_address': None,
'username': None,
@@ -230,9 +231,12 @@ def new_from_json_dict(cls, data, **kwargs):
engagement = data.get('engagement')
if engagement:
engagement = PageEngagement.new_from_json_dict(engagement)
picture = data.get('picture', {}).get('data')
if picture:
picture = PagePicture.new_from_json_dict(picture)
return super(cls, cls).new_from_json_dict(
data=data, category_list=category_list,
cover=cover, engagement=engagement
cover=cover, engagement=engagement, picture=picture
)


@@ -5,8 +5,8 @@
PAGE_FIELDS = [
'id', 'about', 'category', 'category_list', 'checkins', 'cover',
'description', 'description_html', 'display_subtext', 'emails',
'engagement', 'fan_count', 'founded',
'global_brand_root_id', 'link', 'name', 'phone', 'rating_count',
'engagement', 'fan_count', 'founded', 'global_brand_root_id',
'link', 'name', 'phone', 'picture', 'rating_count',
'single_line_address', 'username', 'verification_status', 'website'
]

@@ -30,7 +30,15 @@
"global_brand_root_id": "1499730620315598",
"link": "https://www.facebook.com/facebook/",
"name": "Facebook",
"picture": {
"data": {
"height": 50,
"is_silhouette": false,
"url": "https://scontent.xx.fbcdn.net/v/t1.0-1/p50x50/58978526_10158354585751729_7411073224387067904_o.png?_nc_cat=1&_nc_oc=AQmujTzzsF5lAivKLKTFJhGi5e65dMKAp33aDIEB9AGZQ7TeoCc_frVd5h4z0PqDv4Q&_nc_ht=scontent.xx&oh=a36f52c88fbe9e69c4890b09016a11a0&oe=5E585F54",
"width": 50
}
},
"username": "facebook",
"verification_status": "blue_verified",
"website": "http://www.facebook.com"
}
}
@@ -108,6 +108,7 @@ def testGetPageInfo(self):

page_info_by_name = self.api.get_page_info(username=page_id)
self.assertEqual(page_info_by_name.name, 'Facebook')
self.assertEqual(page_info_by_name.picture.height, 50)

@responses.activate
def testGetPostInfo(self):
@@ -48,13 +48,10 @@ def testPage(self):
page_info.category_list[0].__repr__()
page_info.cover.__repr__()
page_info.engagement.__repr__()
page_info.picture.__repr__()
except Exception as e:
self.fail(e)

origin_json_data = json.dumps(page_data, sort_keys=True)
self.assertEqual(origin_json_data, page_info.as_json_string())
self.assertEqual(page_data, page_info.as_dict())

self.assertEqual(page_info.id, '20531316728')
self.assertTrue(isinstance(page_info.category_list, list))
self.assertTrue(isinstance(page_info.cover, pyfacebook.Cover))
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.