-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdriver.py
More file actions
47 lines (39 loc) · 1.67 KB
/
driver.py
File metadata and controls
47 lines (39 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
# faceit.py
# ----------------------------------------------------------------------------
# Author: Nicholas Price
# Last Modified: 4/3/2023
# version '1.0.0'
# ---------------------------------------------------------------------------
# Description
# This file is the main driver for the scraping of 2014 CSGO hub data. A
# session is first established with the faceit API. From there calls are made
# to the API to retrieve hub match data. The data is parsed for each player
# and the final result is inserted into a CSV and saved to the 2014FACEIT folder.
# ---------------------------------------------------------------------------
import requests
import config, endpoints, csvdataconvert, faceit
if __name__ == '__main__':
# Establish a session #
headers = {
'accept': 'application/json',
'Authorization': config.bPlusKey
}
# Instantiate a session object #
session = requests.Session()
session.headers.update(headers)
response = session.get(endpoints.faceitapi + '/games?offset=0&limit=0')
if not response.status_code == 200:
print("Authentication not successful")
quit()
# Players dictionary is used to return total statistics based on faceit query type #
players = {}
'''
offset = 0
limit = 0
faceit.getHubMatches(hubID=endpoints.faceit2014hubID, players=players, session=session)
'''
#faceit.printHubMembersInfo(hubID=endpoints.faceit2014hubID, session=session)
faceit.getHubMatches(hubID=endpoints.faceit2014hubID, players=players, session=session)
# Final processing to send player data to a csv file #
csvdataconvert.convertPlayerDataToCSV(players)