rustat-python-api 0.1.2__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rustat-python-api
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: A Python wrapper for RuStat API
5
5
  Home-page: https://github.com/dailydaniel/rustat-python-api
6
6
  Author: Daniel Zholkovsky
@@ -2,12 +2,19 @@ import requests
2
2
  import pandas as pd
3
3
  from collections import defaultdict
4
4
  from tqdm import tqdm
5
+ import time
5
6
 
6
7
  from .urls import URLs
7
8
 
8
9
 
9
10
  class RuStatParser:
10
- def __init__(self, user: str, password: str, urls: dict = URLs):
11
+ def __init__(
12
+ self,
13
+ user: str,
14
+ password: str,
15
+ urls: dict = URLs,
16
+ sleep: int = -1
17
+ ):
11
18
  self.numeric_columns = [
12
19
  'id', 'number', 'player_id', 'team_id', 'half', 'second',
13
20
  'pos_x', 'pos_y', 'pos_dest_x', 'pos_dest_y', 'len', 'possession_id', 'possession_team_id',
@@ -18,11 +25,15 @@ class RuStatParser:
18
25
  self.user = user
19
26
  self.password = password
20
27
  self.urls = urls
28
+ self.sleep = sleep
21
29
 
22
30
  self.cached_info = {}
23
31
 
24
- @staticmethod
25
- def resp2data(query: str) -> dict:
32
+ def resp2data(self, query: str) -> dict:
33
+
34
+ if self.sleep > 0:
35
+ time.sleep(self.sleep)
36
+
26
37
  response = requests.get(query)
27
38
  return response.json()
28
39
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rustat-python-api
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: A Python wrapper for RuStat API
5
5
  Home-page: https://github.com/dailydaniel/rustat-python-api
6
6
  Author: Daniel Zholkovsky
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='rustat-python-api',
5
- version='0.1.2',
5
+ version='0.2.0',
6
6
  description='A Python wrapper for RuStat API',
7
7
  long_description=open('README.md').read(),
8
8
  long_description_content_type='text/markdown',