Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. ```
  2. website: https://www.semanticscholar.org/search?q=machine%20learning&sort=relevance
  3.  
  4. I'm trying to calling the API of that website but it's keep replying back with
  5.  
  6. {'error': 'Sorry, an unexpected error occured. Please try again soon.'}
  7.  
  8. But it's works fine from browser !
  9. ```
  10.  
  11. import requests
  12. from bs4 import BeautifulSoup
  13.  
  14.  
  15. data = {
  16.    "queryString": "machine learning",
  17.    "page": 1,
  18.    "pageSize": 10,
  19.    "sort": "relevance",
  20.    "authors": [],
  21.    "coAuthors": [],
  22.    "venues": [],
  23.    "yearFilter": 'null',
  24.    "requireViewablePdf": 'false',
  25.    "publicationTypes": [],
  26.    "externalContentTypes": []
  27. }
  28. r = requests.post(
  29.    'https://www.semanticscholar.org/api/1/search', json=data).json()
  30.    
  31. print(r)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement