Skip to content

Commit 87d248e

Browse files
authored
Merge pull request #8 from ScrapingAnt/feature/issue7-fix-user-agent
feature/issue7-fix-user-agent: done
2 parents 1faa773 + b9ecfea commit 87d248e

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

scrapingant_client/VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.3.1

scrapingant_client/client.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import platform
23
import sys
34
from typing import List, Optional
@@ -19,7 +20,9 @@ class ScrapingAntClient:
1920
def __init__(self, token: str):
2021
self.token = token
2122
self.requests_session = requests.Session()
22-
user_agent = f'ScrapingAntClient ({sys.platform}; Python/{platform.python_version()});'
23+
version_file = open(os.path.join('scrapingant_client', 'VERSION'))
24+
version = version_file.read().strip()
25+
user_agent = f'ScrapingAnt Client/{version} ({sys.platform}; Python/{platform.python_version()});'
2326
self.requests_session.headers.update({
2427
'x-api-key': self.token,
2528
'User-Agent': user_agent,

setup.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1+
import os
2+
13
import setuptools
24

35
with open("README.md", "r", encoding="utf-8") as fh:
46
long_description = fh.read()
57

8+
version_file = open(os.path.join('scrapingant_client', 'VERSION'))
9+
version = version_file.read().strip()
10+
611
setuptools.setup(
712
name="scrapingant-client",
8-
version="0.3.0",
13+
version=version,
914
author="andrii.kovalenko",
1015
author_email="[email protected]",
1116
license='Apache-2.0',

0 commit comments

Comments
 (0)